I have been using the above code to send order (USD/JP) when the RSI is above 70, but I always get error 130.
It seems like I might be violating the Bid - Stoplevel >= 40, but I also have a line of code
to buy when RSI is below 30, and this is actually working.
I cannot figure out why.
I'd appreciate it if someone can help me
I don't see how your OP_BUY example won't work since you used 1000 * Point... have you tried 1000 * Point for OP_SELL?
(note also that you used 'Ask' for SL and TP for both OP_BUY and OP_SELL...)
I don't see how your OP_BUY example won't work since you used 1000 * Point... have you tried 1000 * Point for OP_SELL?
(note also that you used 'Ask' for SL and TP for both OP_BUY and OP_SELL...)
Yes, I have used 1000, but it still didn't work
Yes, I have used 1000, but it still didn't work
Yes, I have used 1000, but it still didn't work
Oh! Now I see it - for OP_SELL, you need to add for SL and minus for TP...
ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Ask - 1000 * Point, Ask + 1000 * Point, NULL);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. Don't you want the same/specified amount for either direction?
- 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.)
![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
I have been using the above code to send order (USD/JP) when the RSI is above 70, but I always get error 130.
It seems like I might be violating the Bid - Stoplevel >= 40, but I also have a line of code
to buy when RSI is below 30, and this is actually working.
I cannot figure out why.
I'd appreciate it if someone can help me
Also, I have set the spread to be 10