How to calculate ATR ratio?

 

Hi,

i have completed the EA as per customer requirement.but he need s/l & t/p should have following conditions.

can anyone help on this. EA placing orders based on 5min chart

Stop Loss & Take profit 30% of Daily ATR with 1:1 Risk Reward Ratio.

attached image will breify more..



 

You can use daily ATR like this:

double ATRValue=iATR(Symbol(),PERIOD_D1,20,0);
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-ATRValue, OrderOpenPrice()+ATRValue,0);

Hope this can answer your question. 

 
caoguangxin:

You can use daily ATR like this:

<CODE DELETED>

Hope this can answer your question. 

Please read some other posts before posting . . .

Please edit your post . . .    please use the   SRC   button to post code: How to use the   SRC   button. 

 
RaptorUK:

Please read some other posts before posting . . .

Please edit your post . . .    please use the   SRC   button to post code: How to use the   SRC   button. 



CODE was deleted, can you post your code.
 
sheriffonline:

CODE was deleted, can you post your code.

Look again,  no code has been deleted . . . 

Reason: