I am getting error 130. I read many articles regarding the same. But couldn't fix the error. because the same code is working with some input and not with some other.
I am using NormalizeDouble function for Tradeprice, SL and TP. Pls help me with it.
SL = NormalizeDouble(SL, Digits);
See also The == operand. - MQL4 programming forum
You can't move stops (or pending prices) closer to the market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL). Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
On some ECN type brokers the value might be zero (broker doesn't know.) Use a minimum of two (2) PIPs.
You buy at the Ask and sell at the Bid.
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using the Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice 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.) Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134.
Thank you. I ll try these things.