Coding a Step Based ATR Trailing Stop Function
CopyBuffer(handleATR,0,1,1,atrValue);
Generally you should check returned value of CopyBuffer. There may be errors during execution of this function, although in your case it only affects the comment value but in other cases it could be catastrophic.
if(posSL != posOpenPrice
Comparing two doubles is not something that works always... I prefer to do it this way:
if(MathAbs(posSL-posOpenPrice)>2*_Point ...
Generally you should check returned value of CopyBuffer. There may be errors during execution of this function, although in your case it only affects the comment value but in other cases it could be catastrophic.
Comparing two doubles is not something that works always... I prefer to do it this way:
Thanks I'll add that stuff in. I'll add multisymbol capability too, shouldn't be that hard
The reason I am posting this here is because I want to know what the rest of you (especially the moderators) think I should add for error checking. Currently I know problems will occur if the trade doesn't have a stoploss and I also want to add error checking for if the trigger for the breakeven is > than the trigger for the trailing stop then it might do weird things. Also its not multisymbol yet so I will eventually add that capability.