Yea it is.
Basically, variables have scope. Variables declared within a given function have scope within that function. IOW, they are destroyed and re-instantiated every time that function is called.
User Inputs, aka extern, variables are declared outside all functions. So they are only destroyed and re-instantiated when the expert is removed from the chart. Unfortunately, when you recompile an EA, it is in effect "removed" and "re-attached" to the chart. So all extern variables are destroyed and re-instantiated, and reset to thier default values.
Since the start() is called on every tick, variables within it are destroyed and re-instantiated at every tick. But variables declared outside all functions are not destroyed and maintain their values - and this is whether they have the extern identifier or not.
Hope that makes some kind of sense.
Basically, variables have scope. Variables declared within a given function have scope within that function. IOW, they are destroyed and re-instantiated every time that function is called.
User Inputs, aka extern, variables are declared outside all functions. So they are only destroyed and re-instantiated when the expert is removed from the chart. Unfortunately, when you recompile an EA, it is in effect "removed" and "re-attached" to the chart. So all extern variables are destroyed and re-instantiated, and reset to thier default values.
Since the start() is called on every tick, variables within it are destroyed and re-instantiated at every tick. But variables declared outside all functions are not destroyed and maintain their values - and this is whether they have the extern identifier or not.
Hope that makes some kind of sense.
turn off terminal. recompile expert. run terminal. input variables are left as set before
tonyc2a, thanks, that does make sense.. I did have to read it twice though! lol
Slawa, thanks for the work-around. However, I think this is just a work around and hope its not a definitive answer. I could not put in a production system (i.e. real money) with this problem.
Can u confirm that it will be fixed at some stage?
Thanks,
Slawa, thanks for the work-around. However, I think this is just a work around and hope its not a definitive answer. I could not put in a production system (i.e. real money) with this problem.
Can u confirm that it will be fixed at some stage?
Thanks,
there is no bug and will be not fixed. as designed.
ooch.. well, that may be the end of a nice try for me...
:( :( :(
I never did like the answer 'this is a feature, not a bug'..
:( :( :(
I never did like the answer 'this is a feature, not a bug'..
there may be different cases. your case is rare. imho
Is it the case that all input variables of running expert advisors are reset to the default values when the expert advisor is simply recompiled?
This is currently wreaking havoc as I have 10 windows with different input parameters for the same advisor. It seems that every time i recompile, all the input variables are reset to default and I quicky have to reset them manually... not fun.
thanks,
This is currently wreaking havoc as I have 10 windows with different input parameters for the same advisor. It seems that every time i recompile, all the input variables are reset to default and I quicky have to reset them manually... not fun.
thanks,
Presuming that your 10 different windows are various pairs and/or time-frames, couldn't you preset the variables, within the program, based on the chart that is in use?
Symbol() will give you the trade pair,
Period() will give you the time-frame for the chart.
So, you could have something like:
If (Symbol() == "EURUSD")
a=4;
If (Symbol() == "GBPUSD")
a=6;
If (Period() == "PERIOD_M5")
b=1;
If (Period() == "PERIOD_M30")
b=2;
G'Jim c):{-
there may be different cases. your case is rare. imho
well, try suggesting your 'feature' to eSignal, TradeMaven, TradeStation users and see how they react... rofl!
Yes, GJim, I guess this is possible and will limit some of the potential problems. Thank-you.
However, it is unweildy code to work around what is a bug, or at best, an error in the system specifications.
:(
However, it is unweildy code to work around what is a bug, or at best, an error in the system specifications.
:(
there may be different cases. your case is rare. imho
well, try suggesting your 'feature' to eSignal, TradeMaven, TradeStation users and see how they react... rofl!
yeah. lets consider 2 cases.
1. some expert working. you need to recompile it but not change its parameters
2. some expert working. you need to recompile it and reset its parameters.
our feature let provide both cases (with workaround)
your suggestion turn off 2-nd case
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
This is currently wreaking havoc as I have 10 windows with different input parameters for the same advisor. It seems that every time i recompile, all the input variables are reset to default and I quicky have to reset them manually... not fun.
thanks,