Ok, not quarrel whatever, since it benefit nobody and nothing. All of us come here to enhance our skill of using MT4 and help each other.
I don't know whether externals, globalscope and statics will be reset in an indicator when changing timeframe, but I think it deserve to confirm by some tests(I will, but now trading close, and I can't use "tester" well. so tomorrow I will test ).
In addition, now I know how to let us set variables' value when EA is being attached like B and the variables can never been changed when shift time frame like in A; and I write the code as C:
I am not the OP, so why am I supposed to try Raptor's code
"Just to be clear, Changing timeframes in an EA resets externals but not globalscope/statics.
But in an indicator,Changing timeframes resets externals, globalscope and statics."
I'm not going to go back 3 pages and check. I assumed, sorry.
You said "Just to be clear" looked like you agreed with me, then in another paragraph (another thought) say something different looking like you disagreed. Learn to use highlighting correctly. Had you posted something like:
Just to be clear,
Changing timeframes in an EA resets externals but not globalscope/statics.
But in an indicator,Changing timeframes resets externals, and globalscope and statics."
I'm not going to go back 3 pages and check. I assumed, sorry.
You said "Just to be clear" looked like you agreed with me, then in another paragraph (another thought) say something different looking like you disagreed. Learn to use highlighting correctly. Had you posted something like:
Just to be clear,
Changing timeframes in an EA resets externals but not globalscope/statics.
But in an indicator,Changing timeframes resets externals, and globalscope and statics."
It would have been clear.
You may not realise that your sarcastic posting style, using phrases such as "What part of "Only externals are reset" was unclear?", "RTFM" and "Did you miss.....?" can get people's backs up.
You are an extremely talented and knowledgeable person and I understand that it can be irritating when so many people post nonsense. But do you really need to be so condescending?
That is a good idea about using bolding/highlighting to make a statement clearer, I will try to remember that in future, thank you.
As you can see, changing tf in an indicator will reset extern, globalscope and static variables, but the same code in an EA will only reset the extern variable
In addition, now I know how to let us set variables' value when EA is being attached like B and the variables can never been changed when shift time frame like in A; and I write the code as C:
in the fact, i just test the code "C", and it can't run and have some errors.
So the problem is still there, How to set variables' value when EA is being attached like B and the variables can never been changed when shift time frame like in A?
What the hell is the matter with you!
You quoted my post and added code that was not mine.
I am not the OP, so why am I supposed to try Raptor's code
Yes I bothered to read and understand the posts
Nothing about "only externals are reset" is unclear
My post was
"Just to be clear, Changing timeframes in an EA resets externals but not globalscope/statics.
But in an indicator,Changing timeframes resets externals, globalscope and statics."
No code at all!
Ok, not quarrel whatever, since it benefit nobody and nothing. All of us come here to enhance our skill of using MT4 and help each other.
I don't know whether externals, globalscope and statics will be reset in an indicator when changing timeframe, but I think it deserve to confirm by some tests(I will, but now trading close, and I can't use "tester" well. so tomorrow I will test ).
In addition, now I know how to let us set variables' value when EA is being attached like B and the variables can never been changed when shift time frame like in A; and I write the code as C:
C:
A:
B:
GumRai:
I am not the OP, so why am I supposed to try Raptor's code
"Just to be clear, Changing timeframes in an EA resets externals but not globalscope/statics.But in an indicator,Changing timeframes resets externals, globalscope and statics."
You may not realise that your sarcastic posting style, using phrases such as "What part of "Only externals are reset" was unclear?", "RTFM" and "Did you miss.....?" can get people's backs up.
You are an extremely talented and knowledgeable person and I understand that it can be irritating when so many people post nonsense. But do you really need to be so condescending?
That is a good idea about using bolding/highlighting to make a statement clearer, I will try to remember that in future, thank you.
The above code in an indicator results in
As you can see, changing tf in an indicator will reset extern, globalscope and static variables, but the same code in an EA will only reset the extern variable
In addition, now I know how to let us set variables' value when EA is being attached like B and the variables can never been changed when shift time frame like in A; and I write the code as C:
C:
A:
bool isFirst = true; datetime time_current; int init(){ if(isFirst) { isFirst = false; time_current=TimeCurrent(); }B:
extern bool isFirst = true; extern datetime time_current; int init(){ if(isFirst) { isFirst = false; time_current=TimeCurrent(); }