the part responsible for opening new orders when i attach the ea is shown below if this might help
Thanks in advance
if(Instants + Pendings == 0) //first run { if(PlaceFirstOrder()) HedgeIt(); }
Just call
OnInit();
When you want to reboot the expert.
i set the line as shown below,
if(Instants == 0 && Pendings == 1) { if(GetLastTrade()==1) //Profit trade { DeletePendings(); Paused = false; OnInit(); email_body = "Congratulation! Takeprofit hits on " + Symbol() + "/" + PeriodToText(); subj = "Congratulation! Takeprofit hits on " + Symbol(); if(EmailOn) xpEmailSend(subj,email_body); if(AlertOn) Alert(subj); }
but when i come i get the error below
'OnInit' - function not definedwhat am i doing wrong ?
i am not a programmer by the way , just trying to figure out how to do it
well the function needs to be defined ,
//+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+
Marco vd Heijden:
well the function needs to be defined ,
may be it's an 'old' mt4 with init()?
a) try to recall init()
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hello,
i have a custom made EA for my trading style, it is set as when TP of the active trade is hit the ea will stop trading and delete the pending order and show on "Paused"
the part responsible for that is quoted below, i want to change it so when TP is hit the EA will re-start itself from the beginning, is this possible ?