Hello all-
I'm new to programming and this forum, and yesterday I wrote a simple EA based on the Parabolic SAR (Buy when it's below current price, sell when it's above). I have already written trailing stops into the program, but currently it initiates a new order in the same direction that I just closed something with the trailing stop (since the SAR hasn't switched over yet). I don't want this; if the last closed trade was a sell, I want the program to wait for appropriate conditions (SAR below price) to initiate a buy, and vice versa. I'm sure there's a simple way to do this, but I can't figure it out .
Thanks a bunch in advance,
GavnerI think that u have to check the the SAR is blow price but also the previous SAR is above previous close price to plase a buy order. Sothing like this
// Check for BUYS
if((Ask>SARCurrent) && (iClose[1] < SARPrevious))
and the opposite for sell
// Check for SELLS
if((Bid SARPrevious))

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all-
I'm new to programming and this forum, and yesterday I wrote a simple EA based on the Parabolic SAR (Buy when it's below current price, sell when it's above). I have already written trailing stops into the program, but currently it initiates a new order in the same direction that I just closed something with the trailing stop (since the SAR hasn't switched over yet). I don't want this; if the last closed trade was a sell, I want the program to wait for appropriate conditions (SAR below price) to initiate a buy, and vice versa. I'm sure there's a simple way to do this, but I can't figure it out
.
Thanks a bunch in advance,
Gavner