drinkyd:
After I do "OrderSend (Symbol(), OP_BUY, 1.0, Ask, 0, Ask - iATR(NULL, 0,14,1)*1.5, Ask + iATR(NULL, 0,14,1), "TEST", 123, 0, GREEN);" on a backtest,
I reviewed the trades and it showed me SL and TP that are calculated using a different ATR value than the value from loading the ATR
indicator on the chart and hovering over the previous closed bar, "1".
I tried a test with the iATR values alone with "Alert" and it matches what I hover over.
I didn't expect the ATR indicator to repaint,
so not sure what is happening here.
Shouldn't the value of the ATR be fixed after a candle closes or
does it have something to do with OrderSend or the actual placement of the order with the server?
so it shouldn't have the seperate SL and TP requirement,
unless I'm wrong.
- You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the
spread on close.
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not
the
Ask. Your SL is shorter by the spread and your TP is longer.
- Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To
trigger at a specific
Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (Control-O) → charts → Show ask line.)
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not
the
Ask. Your SL is shorter by the spread and your TP is longer.
- Not possible. You are reading something wrong.
- As expected.
- It doesn't.
- You are reading something wrong.
- It is.
- Nothing.
- No idea what you mean.
- Obviously you are.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
In MQL4
After I do "OrderSend (Symbol(), OP_BUY, 1.0, Ask, 0, Ask - iATR(NULL, 0,14,1)*1.5, Ask + iATR(NULL, 0,14,1), "TEST", 123, 0, GREEN);" on a backtest, I reviewed the trades and it showed me SL and TP that are calculated using a different ATR value than the value from loading the ATR indicator on the chart and hovering over the previous closed bar, "1".
I tried a test with the iATR values alone with "Alert" and it matches what I hover over. I didn't expect the ATR indicator to repaint, so not sure what is happening here. Shouldn't the value of the ATR be fixed after a candle closes or does it have something to do with OrderSend or the actual placement of the order with the server?
I'm testing with Oanda and I believe it's not a ECN broker, so it shouldn't have the seperate SL and TP requirement, unless I'm wrong.