Change input variable while EA is running on chart is not effective on the same chart. It requires to remove the EA completely and reattach it with changed variable. - page 3

 
fxwithouttears:
some times i wonder how you guys are able to make this ea that you do. how i wish i have some one to tech me coding
Coding's are just another language. Dwell on it and be in it. Best ways to learn.
 
Young Ho Seo:

Hello people.

I just realized that while EA is running on the chart, change in the Input variable (I mean manually) is not effective on the same chart. Actually we need to completely remove the EA from chart and reattach the EA with changed variable to make the variable change effective.

Is there anyway that to make change in input variable  without removing from the chart?

I feel that EA is less responsive like this. Isn't it better to see if the change in input variable is immediately effective on the same chart ? 

Is there any way to get around with this?

Kind regards.

Whenever you change an input parameter by double clicking at the EA, Indicator or script. It does not change the Input though it initializes the robot, the best way to do it is to check for the reason to why the function Ondeinit was called then you can choose to modify your inputs

for example;

void OnDeinit(const int reason)
  {
//---
    if (reason==REASON_PARAMETERS) //input parameters have been changed 
      {
         stoploss = STOPLOSS; //make stoploss same as the one on the input
         takeprofit = TAKEPROFIT; //same for takeprofit
      }
  }




Documentation on MQL5: Event Handling / OnDeinit
Documentation on MQL5: Event Handling / OnDeinit
  • www.mql5.com
OnDeinit - Event Handling - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5