If you want help, attach the mql5 file of the advisor and the mql5 file of the indicator. What you attached above does not fit.
Indicators were attached on initial mensage. However I have attached them again. EAs files attached now.
Errors in the 'LDWIN_UDP' advisor - you are trying to compare non-existent values of the 'UDP' indicator.
For example, the 'UDP' indicator gives fractional values
and you in the advisor, for some reason, expect the values '0' and '1'
if(BufferUP[2]==0 && BufferDN[2]==1 && BufferUP[1]==1 && BufferDN[1]==0) //--- { //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].low); if(HoraNegociacao() == true && PositionsTotal() == 0 && OrdersTotal() == 0) { double Ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); trade.Buy(_volume, Symbol(), 0, Ask - 100 *_Point,Ask + 50 *_Point, "Compra"); { } } } if(BufferUP[2]==1 && BufferDN[2]==0 && BufferUP[1]==0 && BufferDN[1]==1) //--- { //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].high); if(HoraNegociacao() == true && PositionsTotal() == 0 && OrdersTotal() == 0) { double Bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); trade.Sell(_volume, Symbol(),0, Bid + 100 *_Point, Bid - 50 *_Point, "Venda"); { } } }
I didn't look further - you need to fix this error.
Errors in the 'LDWIN_UDP' advisor - you are trying to compare non-existent values of the 'UDP' indicator.
For example, the 'UDP' indicator gives fractional values
and you in the advisor, for some reason, expect the values '0' and '1'
I didn't look further - you need to fix this error.
Thanks Vladimir.
The values '0' and '1' were related to the indicators range on the Symbol which EAs was created for. Based on your comment I have fixed EA as below but it is still not trading.
if(BufferUP[2]<=BufferDN[2] && BufferUP[1]>BufferDN[1]){ //--- //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].low); if(HoraNegociacao() == true && PositionsTotal() == 0 && OrdersTotal() == 0){ double Ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); trade.Buy(_volume, Symbol(), 0, Ask - 100 *_Point,Ask + 50 *_Point, "Compra");{ } } } if(BufferUP[2]>=BufferDN[2] && BufferUP[1]<BufferDN[1]){ //--- //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].high); if(HoraNegociacao() == true && PositionsTotal() == 0 && OrdersTotal() == 0){ double Bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); trade.Sell(_volume, Symbol(),0, Bid + 100 *_Point, Bid - 50 *_Point, "Venda");{ } } }
Thanks Vladimir.
The values ' 0 ' and ' 1 ' were related to the indicators range on the Symbol which EAs was created for. Based on your comment I have fixed EA as below but it is still not trading.
Your settings are incompatible with trading. I removed the time limit and dropped the mention of PENDED orders. Added print output if trade order is unsuccessful.
if(isNewBar()) { CopyBuffer(UDP_Handle, 0, 0, 3, BufferUP); CopyBuffer(UDP_Handle, 1, 0, 3, BufferDN); CopyRates(Symbol(), Period(), 0, 3, rates); if(BufferUP[2]<=BufferDN[2] && BufferUP[1]>BufferDN[1]) //--- { //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].low); if(/*HoraNegociacao() == true && */PositionsTotal() == 0 /*&& OrdersTotal() == 0*/) { double Ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); if(!m_trade.Buy(_volume, Symbol(), 0, Ask - 100 *_Point,Ask + 50 *_Point, "Compra")) Print(__FILE__," ",__FUNCTION__,", ERROR: ","#3 BUY -> false. Result Retcode: ",m_trade.ResultRetcode(), ", description of result: ",m_trade.ResultRetcodeDescription()); } } if(BufferUP[2]>=BufferDN[2] && BufferUP[1]<BufferDN[1]) //--- { //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].high); if(/*HoraNegociacao() == true && */PositionsTotal() == 0 /*&& OrdersTotal() == 0*/) { double Bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); if(!m_trade.Sell(_volume, Symbol(),0, Bid + 100 *_Point, Bid - 50 *_Point, "Venda")) Print(__FILE__," ",__FUNCTION__,", ERROR: ","#3 Sell -> false. Result Retcode: ",m_trade.ResultRetcode(), ", description of result: ",m_trade.ResultRetcodeDescription()); } } }
Your settings are incompatible with trading. I removed the time limit and dropped the mention of PENDED orders. Added print output if trade order is unsuccessful.
I had to change the "m_trades.*" from your code to "trades.*" in order to fit the "CTrade trade". By adding your code the EA did not compile. Even with the changes EA is still not trading.
if(isNewBar()) { CopyBuffer(UDP_Handle, 0, 0, 3, BufferUP); CopyBuffer(UDP_Handle, 1, 0, 3, BufferDN); CopyRates(Symbol(), Period(), 0, 3, rates); if(BufferUP[2]<=BufferDN[2] && BufferUP[1]>BufferDN[1]) //--- { //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].low); if(/*HoraNegociacao() == true && */PositionsTotal() == 0 /*&& OrdersTotal() == 0*/) { double Ask=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_ASK),_Digits); if(!trade.Buy(_volume, Symbol(), 0, Ask - 100 *_Point,Ask + 50 *_Point, "Compra")) Print(__FILE__," ",__FUNCTION__,", ERROR: ","#3 BUY -> false. Result Retcode: ",trade.ResultRetcode(), ", description of result: ",trade.ResultRetcodeDescription()); } } if(BufferUP[2]>=BufferDN[2] && BufferUP[1]<BufferDN[1]) //--- { //ObjectCreate(0, rates[1].time, OBJ_ARROW_CHECK, 0, rates[1].time, rates[1].high); if(/*HoraNegociacao() == true && */PositionsTotal() == 0 /*&& OrdersTotal() == 0*/) { double Bid=NormalizeDouble(SymbolInfoDouble(Symbol(),SYMBOL_BID),_Digits); if(!trade.Sell(_volume, Symbol(),0, Bid + 100 *_Point, Bid - 50 *_Point, "Venda")) Print(__FILE__," ",__FUNCTION__,", ERROR: ","#3 Sell -> false. Result Retcode: ",trade.ResultRetcode(), ", description of result: ",trade.ResultRetcodeDescription()); } } }
- 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 everybody!
I am a beginner on programming. I have created two EAs:
One is based on colors changes provided by the indicator "i-impulsesystem". I have used the iCustom fucntion with no inputs in accordance with the indicator. The EA should buy when candle[2] color is red or grey and candle[1] is green. Bythe other side, EA should sell when candle[2] color is green or grey and candle[1] is red. The EA code is compiling without errors (LDWDO_IMPULSE compilation file attached) but no tradings are performed on backtest (LDWDO_IMPULSE 09192020 test log file attached) and live market.
The other EA is based on UP and DOWN buffers crossing over provided by the indicator "UDP". The EA should buy when candle[2] UP =0 and DOWN =1 and candle[1] UP =1 and DOWN =0. Bythe other side, EA should sell when candle[2] UP =1 and DOWN =0 and candle[1] UP =0 and DOWN =1. The EA code is compiling without errors (LDWIN_UDP compilation file attached) but no tradings are performed on backtest (LDWIN_UDP 09192020 test log file attached), I have not tried it on live market yet.I appreciate should you help me out to fix these issues. I have created EAs with iCustom before and they ran allright. But somehow I am not figuring out how to deal with the buffers on both indicators herein.
Thanks!