my ea make error 4756
can you help me thanks
- www.mql5.com
CopyHigh(_Symbol,_Period,TimeCurrent(),5,hg);
Top = NormalizeDouble(rates[ArrayMaximum(hg,0,WHOLE_ARRAY)].high,_Digits);
- misunderstood design.
Choose among the values of the maximum double and use that instead of the integer index
my ea make error 4756
can you help me thanks
Error 4756 is "Trade request sending failed". If you have error when sending order, check the return code of MqlTradeResult
//--- send order OrderSend(mrequest,mresult); // get the result code if(mresult.retcode==10009 || mresult.retcode==10008) //Request is completed or order placed { Alert("An order has been successfully placed with Ticket#:",mresult.order,"!!"); } else { Alert("The order request could not be completed -error:",GetLastError()," with trade return code ",mresult.retcode); ResetLastError(); return; }
According to Konstantin83 above, you have invalid stop error, which mean you have to place pending order outside SymbolInfoInteger SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL.
Error 4756 is "Trade request sending failed". If you have error when sending order, check the return code of MqlTradeResult
According to Konstantin83 above, you have invalid stop error, which mean you have to place pending order outside SymbolInfoInteger SYMBOL_TRADE_STOPS_LEVEL and SYMBOL_TRADE_FREEZE_LEVEL.
Is invalid stops also returned for an ECN type Broker ?
Of course you know that the answer is no. But why asking that ?
- www.mql5.com
Really ? that's interesting. I have to check it later ;D.
I have been investigating a little while trying to find my way with mql5. If the Strategy Tester behaviour is similar to what would be returned by a Broker then it seems that SL & TP are ignored when sent for a Symbol whose ENUM_SYMBOL_TRADE_EXECUTION is Exchange execution or Market execution and no error is returned. So things are quite different compared to mql4.
Something else I have found regarding Invalid Stops. I have a simple EA that places a trade with SL & TP unless the Symbol is Exchange or Market execution, then it sends the trade with SL & TP not set and then sends a second request to (TRADE_ACTION_SLTP) to set the SL & TP.
It works fine in the Strategy tester, so today I tried it on a Demo account and I kept getting Invalid Stops (error 10016). So I checked the Stops Level and Freeze Level, they are both 0, I tried various levels of SL & TP, nothing worked. I could manually set the same SL & TP for an existing position without any problems . . . so then I added a test to only place the SL & TP if the position could be selected . . . and no more Invalid Stops, no more TRADE_ACTION_SLTP trade request either :-(
So I added this code between the completion of the initial trade request sent without TP & SL and the subsequent trade request that sends the TP & SL . . .
SelectRetryCount = 1; if(SetTPandSL) { while(!PositionSelect(_Symbol) && SelectRetryCount < 10) { Sleep(SelectRetryCount * 100); // sleep for SelectRetryCount * 100 mS SelectRetryCount++; } }
SetTPandSL is set true if the initial trade request is successful, there is no point trying to set a TP & SL if it isn't. The position is selected and if it fails a 100 mS sleep happens, then the select is retried, if that fails a 200 mS sleep happens, etc for upto 9 attempts (4.5 secs total).
I don't really know what I'm doing with mql5 yet, I'm really just hacking about trying to make a few things work and hoping to learn as I go . . . is what I have found here normal behaviour ? I would have thought that once the initial trade request returned 10009 - TRADE_RETCODE_DONE I would be OK to send the request to set the TP & SL, isn't this the case ? does anyone know ?
Something else I have found regarding Invalid Stops. I have a simple EA that places a trade with SL & TP unless the Symbol is Exchange or Market execution, then it sends the trade with SL & TP not set and then sends a second request to (TRADE_ACTION_SLTP) to set the SL & TP.
It works fine in the Strategy tester, so today I tried it on a Demo account and I kept getting Invalid Stops (error 10016). So I checked the Stops Level and Freeze Level, they are both 0, I tried various levels of SL & TP, nothing worked. I could manually set the same SL & TP for an existing position without any problems . . . so then I added a test to only place the SL & TP if the position could be selected . . . and no more Invalid Stops, no more TRADE_ACTION_SLTP trade request either :-(
So I added this code between the completion of the initial trade request sent without TP & SL and the subsequent trade request that sends the TP & SL . . .
SetTPandSL is set true if the initial trade request is successful, there is no point trying to set a TP & SL if it isn't. The position is selected and if it fails a 100 mS sleep happens, then the select is retried, if that fails a 200 mS sleep happens, etc for upto 9 attempts (4.5 secs total).
I don't really know what I'm doing with mql5 yet, I'm really just hacking about trying to make a few things work and hoping to learn as I go . . . is what I have found here normal behaviour ? I would have thought that once the initial trade request returned 10009 - TRADE_RETCODE_DONE I would be OK to send the request to set the TP & SL, isn't this the case ? does anyone know ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
my ea make error 4756
can you help me thanks