I solved that by using variables, such as
ordcls = OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen);
I have a problem about debug. Could you help me?
Just Check, Why Not?
//Check position bool IsTrade = False; for (int i = 0; i < Total; i ++) { if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) continue; if ( OrderMagicNumber() != MagicNumber ) continue; if(OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { IsTrade = True; if(OrderType() == OP_BUY) { //Close //+------------------------------------------------------------------+ //| Signal Begin(Exit Buy) | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Signal End(Exit Buy) | //+------------------------------------------------------------------+ if (Order == SIGNAL_CLOSEBUY && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { if(!OrderClose(OrderTicket(), OrderLots(), Bid, Slippage, MediumSeaGreen)) Print("OrderClose error ",GetLastError()); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Bid, Digits) + " Close Buy"); if (!EachTickMode) BarCount = Bars; IsTrade = False; continue; } //Trailing stop if(UseTrailingStop && TrailingStop > 0) { if(Bid - OrderOpenPrice() > point * TrailingStop) { if(OrderStopLoss() < Bid - point * TrailingStop) { if(!OrderModify(OrderTicket(), OrderOpenPrice(), Bid - point * TrailingStop, OrderTakeProfit(), 0, MediumSeaGreen)) Print("OrderModify error ",GetLastError()); if (!EachTickMode) BarCount = Bars; continue; } } } } else { //Close //+------------------------------------------------------------------+ //| Signal Begin(Exit Sell) | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Signal End(Exit Sell) | //+------------------------------------------------------------------+ if (Order == SIGNAL_CLOSESELL && ((EachTickMode && !TickCheck) || (!EachTickMode && (Bars != BarCount)))) { if(!OrderClose(OrderTicket(), OrderLots(), Ask, Slippage, DarkOrange)) Print("OrderClose error ",GetLastError()); if (SignalMail) SendMail("[Signal Alert]", "[" + Symbol() + "] " + DoubleToStr(Ask, Digits) + " Close Sell"); if (!EachTickMode) BarCount = Bars; IsTrade = False; continue; } //Trailing stop if(UseTrailingStop && TrailingStop > 0) { if((OrderOpenPrice() - Ask) > (point * TrailingStop)) { if((OrderStopLoss() > (Ask + point * TrailingStop)) || (OrderStopLoss() == 0)) { if(!OrderModify(OrderTicket(), OrderOpenPrice(), Ask + point * TrailingStop, OrderTakeProfit(), 0, DarkOrange)) Print("OrderModify error ",GetLastError());; if (!EachTickMode) BarCount = Bars; continue; } } } } } }
Ask the owner of the source code to give it to you or have him fix it for you.
Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property.
Either way we will not be an accomplice after the fact to theft.
See also forum.MQL4.com/41864#490649
If you post decompiled code again, you will likely be banned.
Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because "someone uploaded it, I don't know why I can't use that"?
how to fix?
return value of 'OrderClose' should be checked
// Custom function to close all open positions void CloseAllPositions() { for (int i = OrdersTotal() - 1; i >= 0; i--) { if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) { OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),3,clrRed); positionsCount--; } } }
- 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 a problem about debug. Could you help me?