Can you discribe in words what it is you are trying to do? I am lazy when it comes to trying to understand the logic of someone else's code.
- If the command fails, print out WHY
if (OrderSend(...) < 0) Alert("OrderSend failed ",GetLastError());
Note you can NOT useif (!OrderSend(...
because it returns a -1 on failure not zero. Bid-30*point,4,Ask-62*point,Ask-2*point,"HA SELL
You can not place a TP/SL closer than MarketInfo(Symbol(), MODE_STOPLEVEL)*Point from the open. On IBFX that's 30 points. When I tried to use pending orders the failure was also setting TP/SL too close to market even though when the order would open the stops would have been fine. This may have been related to #4 below.
- EA's should adjust for 5 digit brokers TP, SL, AND slippage
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init(){ if (Digits == 5 || Digits == 3){ // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
- On ECN brokers, you must open the order first and THEN set the TP/SL.

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