Login Page - Create Account

Support Board


Date/Time: Tue, 07 May 2024 18:29:27 +0000



[Programming Help] - Auto trading with Stops/Profits

View Count: 680

[2020-06-05 21:43:35]
Jjgu - Posts: 8
I'm looking trading with respect to a Moving average while having a pre-set profit & stop loss. I'm using the chart base system where if the trade closes above the MA then I will long and when it closes below I short.

What I'm looking to achieve is let's say I'm short and price is trading below my MA. Profit stop is hit. I do not want it to re-enter again until price is trading above the MA again. What seems to happen is it will enter short again on the next bar because price is still trading below my MA.

My Buy Entry is: =AND(AC3=1,$J$8=0) where AC3=1 is above MA and J8=0 is no current position
My Buy Exit is: =(AC3=-1)
(And vice versa for sell entry)

Could someone please advise how I can set this up? Thank you!
Date Time Of Last Edit: 2020-06-05 22:09:45
[2020-06-06 13:44:30]
Jjgu - Posts: 8
Bump.
[2020-06-08 02:55:13]
Jjgu - Posts: 8
Bump
[2020-06-08 03:41:24]
Sawtooth - Posts: 3993
You'll need to create a persistent variable of your entry signal in a Formula Column other than K/M, where you also release it in the same formula, then find the transitions from 0 to 1, or 1 to 0, with a formula in K3/M3.

Here is a simplistic example:
Spreadsheet Example Formulas and Usage: Buy on First Signal and Ignore Multiple Signals
[2020-06-11 19:23:41]
Programming_autotrading_phonesup - Posts: 59
Send me a Direct Message if you need additional help.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account