Login Page - Create Account

Support Board


Date/Time: Sun, 05 May 2024 03:55:30 +0000



[Programming Help] - Prevent consecutive directional trades

View Count: 865

[2020-06-08 14:20:21]
Jjgu - Posts: 8
Currently using the spreadsheet autotrading feature and I'm trying to configure it so it will not enter 2 buy/sells in a row consecutively. For example when I'm long and it hits my stop it will flatten. I would like it so it will not take another long trade and wait until the sell/short signal hits. Hoping someone could help out with this feature. Thanks!
[2020-06-08 16:29:55]
JayShea - Posts: 92
Are you getting consecutive signals? If you are, my inelegant solution in the spreadsheet (assume the formula column is K), then include in the formula in K3 the condition K4=0. If you have a condition such as O>C or equally specific, then I wouldn't recommend K4=0.
[2020-06-08 16:41:40]
Jjgu - Posts: 8
My K3 (buy entry) is =AND(AC3>0,$J$8=0) - Where AC3>0 is when the price is over MA. (Vice versa for Sell entry) So your suggestion is to edit it so it becomes: =AND(AC3>0,K4=0,$J$8=0) ? If i'm understanding you correctly. Thanks!
Date Time Of Last Edit: 2020-06-08 16:42:18
[2020-06-08 21:38:58]
Jjgu - Posts: 8
Bump
[2020-06-08 22:29:46]
JayShea - Posts: 92
I can see that you wouldn't want every bar exceeding the MA to signal. Could you not add AC4<0 instead of K4=0 to recognize the change? Or do I not understand your intent?
[2020-06-08 23:14:15]
Jjgu - Posts: 8
Right but if it hits my stop when it's still above the MA I don't want it to signal again and re-enter. I want it to wait for the opposite signal to short instead.

Ex. hits my $500 profit target. I want it to flatten and not re-enter until it's time to short.
[2020-06-09 15:48:33]
bradh - Posts: 854
Not sure what the formula in AC3 is, but if you can make it negative when the price is below the MA, and 0 when equal to the MA, then you will only get one signal per crossover.

If the previous bar is still above the MA, you would not get a signal if AC4 > 0:

=AND(AC3>0,AC4<=0,$J$8=0)

Of course, there are other ways to do this too, but you want to only get a signal at the crossover.

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

Login

Login Page - Create Account