Access ATR Value

 

HI.

I want to build an expert advisor that will automatically set my SL to 2xATR of the position I'm in

Tried a few things but they didn't work

Any kind of help is much appreciated

 

Hi, you can move SL by ATR with this code:

double atr = iATR(NULL,0,14,0);

double SL = SL - (2*atr);

 
Tomas Michalek:

Hi, you can move SL by ATR with this code:

double atr = iATR(NULL,0,14,0);

double SL = SL - (2*atr);

I am not sure what you are trying to do there. You have not assigned an initial value to SL and then you are subtracting 2*atr. ?????

Reason: