double ATRPointsB=iATR(NULL,0,14,1); double slB=NormalizeDouble((ATRPointsB)*2, _Digits); //for SL calculation double TP = NormalizeDouble((ATRPointsS)*4, _Digits); double ticket=OrderSend(Symbol(), OP_BUY, Lot_Extract, PriceAsk, 0, PriceBefore - slB, PriceBefore + TP, "BUY", magicNumber, 0, CLR_NONE); if(ticket<0) { Print("OrderSend failed with error #",GetLastError()); } else Print("OrderSend placed successfully",Hour()); Print("slDec ",NormalizeDouble((ATRPointsS)*2, _Digits), " - tpDec",TP); //i was checking tp and sl on the journal tab }thats it, thats my code for entering the position, (buy position). Strange thing is it only affected USDCHF and EURCAD, other pair working fine(atr calculation is right).
Print("slDec ",NormalizeDouble((ATRPointsS)*2, _Digits), " - tpDec",TP); //i was checking tp and sl on the journal tab
Where do you declare ATRPointsS, assign a value to it and why are you multiplying it by 2?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
so i was creating an EA. My EA using an ATR as a stoploss placement. Here is the code.
for TP iwas using 2 times SL, in that case calculated properly, for example , if sl was 10 pips, tp will alwas 20 pips.
my question is "Why my code calculated ATR differently". Some pair my EA calculated perfectly, but in this case USDCHF and EURCAD my SL was way bigger, and i dont know why.
for USDCHF supposedly the SL is 85*2 = 170 pips, but i got 334 instead. I really new for forum stuff and this is my first thread so sorry if i make some mistakes.