How to reset an EA extern variable to its default setting within the EA
The method I use is to not change them in the first place . . . let me explain. If I want to change an extern I use a local copy, for example . . . extern LineColor = Red if I want o change this color instead of using LineColor = Blue; I use
lLineColor = Blue; then I have the option at a later time to do this: lLineColor = LineColor;
Please don't double post !
If you don't change them, you don't have to reset them. Like Raptor said, use a copy and reset the copy.
extern color lineColor = Red; : int init(){ onInit(); ... } : color currentLineColor; OnInit(){ currentLineColor = lineColor; } : if (newTrade){ OnInit(); ...
if you modify globals or externals like slippage *= 10; then EACH deinit/init cycle will increase the variable. Every Chart Refresh, change of pair or timeframe, etc.
I have an EA that i will like to reset its external variables to the default setting within the EA after a trade is taken, can you advise on how to achieve that?
Thanks
Iddy