Can anyone help me. My EA works perfectly as I would expect on strategy tester but in real time I get a lot "129 invalid price" errors especially from
what I can see just on the sell trade rules. The rules seem fine the pip digits all seem fine can any one else explain why this might be happening
in real time and not on the tester
- Works on the strategy tester but not on live trading
- ea have no errors trade on live but can not backtest on strategy tester help
- sell stop and gaps
Adam Woods:
Can anyone help me. My EA works perfectly as I would expect on strategy tester but in real time I get a lot "129 invalid price" errors especially from what I can see just on the sell trade rules. The rules seem fine the pip digits all seem fine can any one else explain why this might be happening in real time and not on the tester
Can anyone help me. My EA works perfectly as I would expect on strategy tester but in real time I get a lot "129 invalid price" errors especially from what I can see just on the sell trade rules. The rules seem fine the pip digits all seem fine can any one else explain why this might be happening in real time and not on the tester
Because your code has to deal with "real" life and not with a protected tester environment. Fix your code and post the relevant part if you need help.
And please use the Search engine.
Thanks for looking please see the enter trade function below.
//+------------------------------------------------------------------+ //| TRADE PLACING FUNCTION | //+------------------------------------------------------------------+ void EnterTrade(int type){ int err=0; double price=Bid, sl=0, tp=0, lotsize = 0; lotsize=Lotsize;//this sets the lotsize to the preset if(UseAutolotsizing) { lotsize=NormalizeDouble((AccountEquity()/1000)*AmountPer1k,2); Comment("The calculated lot size is: ",DoubleToStr(lotsize,2)); } { if(TotalOpenBuyOrders()==3) lotsize = (TotalOpenBuyOrders()+SmartinggaleAmount)*Lotsize; else lotsize = (TotalOpenSellOrders()+SmartinggaleAmount)* Lotsize; } if(type == OP_BUY) { if (TotalOpenSellOrders()==3) lotsize = (TotalOpenSellOrders()+SmartinggaleAmount)*Lotsize; else lotsize = (TotalOpenBuyOrders()+SmartinggaleAmount)*Lotsize; } { price =Ask; } //---- int ticket = OrderSend(Symbol(),type,lotsize,price,30,0,0,"normaltrade",magic,0,Magenta); if(ticket>0) { if(OrderSelect(ticket,SELECT_BY_TICKET)) { if(OrderType()==OP_SELL) { sl = OrderOpenPrice()+(StopLoss*pips); if(StopLoss==0)sl=0; tp = BreakevenOfSells()-(TakeProfit*pips); } else if(OrderType()==OP_BUY) { sl = OrderOpenPrice()-(StopLoss*pips); if(StopLoss==0)sl=0; tp = BreakevenOfBuys()+(TakeProfit*pips); } //---Modify This Order if(!OrderModify(ticket,price,sl,tp,0,Magenta)) { err = GetLastError(); Print("Encountered an error during modificationA!"+(string)err+" "+ErrorDescription(err) ); } //---Modify The Other Orders that are Open. if(TotalOpenOrders() > 1) { for(int i=0;i<OrdersTotal()-1;i++) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderMagicNumber()==magic) if(OrderType()==type) if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tp,0,clrMagenta)) { err = GetLastError(); Print("Encountered an error during modificationB!"+(string)err+" "+ErrorDescription(err) ); } } } } else {//in case it fails to select the order for some reason Print(__FUNCTION__,"Failed to Select Order ",ticket); err = GetLastError(); Print("Encountered an error while seleting order "+(string)ticket+" error number "+(string)err+" "+ErrorDescription(err) ); } } else {//in case it fails to place the order and send us back a ticket number. err = GetLastError(); Print("Encountered an error during order placement!"+(string)err+" "+ErrorDescription(err) ); if(err==ERR_TRADE_NOT_ALLOWED)MessageBox("You can not place a trade because \"Allow Live Trading\" is not checked in your options. Please check the \"Allow Live Trading\" Box!","Check Your Settings!"); } }
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