What's that code ? There is not even an OrderSend() for you requests. Post real code if you need help.
What's that code ? There is not even an OrderSend() for you requests. Post real code if you need help.
Hi Alain
My EA is not working at all , the trading journal gave back none of errors and trade, no execution happened.
I just want a simple trading : if BuyCondition is ture, check the position, if buy opened ->return, if sell opened ->close position and buy, if no position then buy.
if SellCondition is ture, check the position, if sell opened ->return, if buy opened ->close position and sell, if no position then sell.
But my code does not work:
if(BuyCondition) { if (Buy_opened )return; else if (Sell_opened ) { BoRequest.action = TRADE_ACTION_DEAL; BoRequest.price = SymbolInfoDouble(position_symbol,SYMBOL_ASK); BoRequest.symbol = position_symbol; BoRequest.volume = volume; BoRequest.magic = EA_Magic; BoRequest.type = ORDER_TYPE_BUY; BoRequest.type_filling = GetFilling(BoRequest.symbol); BoRequest.deviation=20; OrderSend(BoRequest,BoResult); Print(BoResult.retcode); } else { BoRequest.action = TRADE_ACTION_DEAL; BoRequest.price = NormalizeDouble(latest_price.ask,_Digits); BoRequest.sl = NormalizeDouble(latest_price.ask - STP*_Point,_Digits); BoRequest.symbol = _Symbol; BoRequest.volume = Lot; BoRequest.magic = EA_Magic; BoRequest.type = ORDER_TYPE_BUY; BoRequest.type_filling = GetFilling(BoRequest.symbol); BoRequest.deviation=20; OrderSend(BoRequest,BoResult); Print(BoResult.retcode," ",BoResult.ask," ",SymbolInfoInteger(Symbol(),SYMBOL_DIGITS)," ",BoRequest.volume); if(BoResult.retcode==10009 || BoResult.retcode==10008) { Alert("completed #:",BoResult.order,"!!"); } else { Alert("not completed:",GetLastError()); ResetLastError(); return; } return; } } if(SellCondition) { if (Sell_opened) return; else if (Buy_opened) { BoRequest.action = TRADE_ACTION_DEAL; BoRequest.price = SymbolInfoDouble(position_symbol,SYMBOL_BID); BoRequest.symbol = position_symbol; BoRequest.volume = volume; BoRequest.magic = EA_Magic; BoRequest.type = ORDER_TYPE_SELL; BoRequest.type_filling = GetFilling(BoRequest.symbol); BoRequest.deviation=20; OrderSend(BoRequest,BoResult); Print(BoResult.retcode); } else { BoRequest.action = TRADE_ACTION_DEAL; BoRequest.price = NormalizeDouble(latest_price.bid,_Digits); BoRequest.sl = NormalizeDouble(latest_price.ask + STP*_Point,_Digits); BoRequest.symbol = _Symbol; BoRequest.volume = Lot; BoRequest.magic = EA_Magic; BoRequest.type = ORDER_TYPE_SELL; BoRequest.type_filling = GetFilling(BoRequest.symbol); BoRequest.deviation=20; OrderSend(BoRequest,BoResult); Print(BoResult.retcode," ",BoResult.ask," ",SymbolInfoInteger(Symbol(),SYMBOL_DIGITS)," ",BoRequest.volume); if(BoResult.retcode==10009 || BoResult.retcode==10008) { Alert("completed #:",BoResult.order,"!!"); } else { Alert("not completed:",GetLastError()); ResetLastError(); return; } return; } }
- 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 I coded a simple EA for my first try, but it does not work when it was tested. I got the problem about "unsupported filling type" last time and I added some new code to solve this, but this time it still does not work by sending the error code: 4753. I am really confused becoz I dont know where is the problem from the buy/sell part of code.
I post my code here and hope anyone be kind to point out the problem and give me some suggestion.Thx!
The logic of EA is quiet simple:If fast moving average cross up slow moving average then buy or (close sell positon and buy)
If fast moving average cross down slow moving average then sell or (close buy positon and sell)