barnacle7: I am aware that the static will reset , if the Ea initialises again. FALSE
Static's (and Globally declared) variables are only reset if the EA is loaded again (removed and reloaded).
Changing chart/EA parameters etc results in a deinit() init() cycle but that does NOT reset variables.
WHRoeder:
Static's (and Globally declared) variables are only reset if the EA is loaded again (removed and reloaded).
Changing chart/EA parameters etc results in a deinit() init() cycle but that does NOT reset variables.
external static variable - MQL4 forum
Yes, thanks Whroeder for clarifying, any suggestions on the issue ?

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
Problem: (2nd) Trade re enters straight away when the Stop Loss or Take Profit is hit even though the " xcross " for the entry signal/criteria has not changed from eg; from a Buy to a Sell.
I am aware that the static will reset , if the Ea initialises again.
When I place this on the chart and press the EA button,
The Static xcross and Lastordertype both initialise as 0, and once the (trade criteria) MA cross occurs a (1st) trade is placed. The Static xcross ("Alert" Shows Minutes ,when cross occured) and Last ordertype update ("Alert" Shows the ordertype).
When the trade hits the stop Loss or the Take Profit. It re enters another (2nd) trade again straight away. When this trades Stop Loss or Take Profit is hit it exits.
(3rd) Now the trade DOES NOT re enter straight away and it waits for the xcross time and minute(timecurrent) to equal then it re enters a trade, This is correct.
I don't understand why trade (1st) exits and then re enters trade (2nd) straight away ? It should wait for Static xcross time and Minutes(Timecurrent ) to equal , as it does with trade (3rd) before re entering.
Any assistance is welcomed, thanks