None of the posted codes doesn't open trades, giving errors 2021.02.08 23:43:23.200 my_first_ea_sartrailing (ES,M1) Alert: Request to set Buy order failed - error code:4756 At the same time the request for prices seems to be actual 2021.02.08 23:43:23.200 my_first_ea_sartrailing (ES,M1) Alert: action= 1price= 3900.88sl= 3900.58tp= 3901.88volume= 0.1magic= 12345type= 0type_filling= 0deviation= 1000
Hi folks, I changed OrderSend for the Trade object, much easier. Also the event is executed every second, there is no need for such a fast frequency. I changed it to every 60 seconds and it improves drastically the performance.
protected:
string m_symbol; // symbolENUM_TIMEFRAMES m_timeframe; // timeframebool m_eachtick; // run on every tickbool m_indicator; // show the indicator on the chartbool m_button; // show on/off buttonint m_button_x; // button's x-coordinateint m_button_y; // the coordinate of the buttoncolor m_bgcolor; // button colourcolor m_txtcolor; // button caption colourint m_shift; // bar offsetbool m_onoff; // on/offint m_handle; // indicator handledatetime m_lasttime; // time of the last trailing stop executionMqlTradeRequest m_request; // trade request structureMqlTradeResult m_result; // structure of the trade request resultint m_digits; // the number of decimal places of the pricedouble m_point; // item valuestring m_objname; // button namestring m_typename; // trailing stop type namestring m_caption; // button inscription
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Look like this is a dead discussion but I will put my comments in.
There are a couple of errors found during compiling that need to be resolved.
In the ZeroMemory request on line 116 the compiler says
'ZeroMemory' - unexpected toke, probably type is mission?
'mrequest' - declaration without type
This looks like the mrequest was not properly declared with a type......Not sure how to fix this.
Also,
return value of "OrderSend" should be checked. on line215 and 262
This looks like it might be returning a value it should not.
Any help in fixing these two issues would be most appreciated.
Chris
Really want to understand what is written in the comments ?
class CTrailingStop{
Really want to understand what the comments say ?
Regards, Vladimir.