Build 646: Bool variables are not giving the correct settings - page 4

 
deysmacro:
It is better that MetaQuotes gives the ability so that user can decide either he wants to reset or not after recompiling, right ?   Yes I agree.
 
alop: I don't get your example with EXTERN written with cap locks? 
// #define EXTERN extern
EXTERN typename var1=...;
EXTERN typename var2=...;
As long as the #define is commented out there are no externs. Uncomment, then they ALL become extern.
 

WHRoeder... I'm still a little confused to what you are saying... 

 So how would the code be written - to force variable changes in the charts on re-compile? 

 This is a BIG deal to many of us - I think from BOTH perspectives...

Some people don't want the variables to change on recompile - and I TOTALLY understand...

 But for others - who have 30+ pairs running - having to click "reset" in each chart is a DISASTER...

 Anyway, I think what you're saying is the above code change will either force variable changes, or not... 

 Could you please give an example kinda like:

Force variable change:

 (example here)

No force variable change: 

 (example here)

 

I think the above would be very helpful to both sides of this scenario...

Thanks so much for your help! 

 

 

Also - If we do want to force the variable changes in the active charts (eas) - Isn't there a cache file we can just delete to force the variable change on recompile?

 I've tried to find it - but the stored values seem to be hidden in a mystery file somewhere...

Thanks again for your help...

The above code examples would do the trick too, but it would be nice to know where to find the cache settings - as another workaround....  

 

So also... 

If I change the line

 

#define EXTERN extern 

extern typename var1=...; 

 to

#define EXTERN extern 

define extern typename var1=...; 

 

I get an error reading - external variables have already been defined...

 So - I guess - your workaround seems confusing, could you please clarify..  

 

Thanks so much. 

 
whistler:

So also... 

If I change the line

 

extern typename var1=...; 

 to

define extern typename var1=...; 

 

I get an error reading - external variables have already been defined...

 So - I guess - your workaround seems confusing, could you please clarify..  

 

Thanks so much. 

Try this:

  #define EXTERN  and put nothing here    

 

EXTERN bool trade1          =true;  <= Add EXTERN where you would normally have extern

EXTERN bool trade2          = true;

EXTERN bool trade3          = false; 

 

When you want to add the externs to the beginning do this :

 #define EXTERN      extern

When you want to remove extern do this:

 #define EXTERN   make sure your remove extern like below   

  #define EXTERN  

 

Andy 

 

Manual input dialogue is not usually neccessary during the coding stage so just dont use the extern modifier until coding changes are completed.

// will not reset on recompile unless the value is changed in the code.
extern int Var1 = 20;
extern int Var2 = 40;
//will always reset on recompile
int Var1 = 20;
int Var2 = 40;
 

Awesome stuff.. Thanks so much...

 I removed extern and recompiled, but when I launched MetaTrader and looked at the EA settings from the chart - the variables I removed extern from had disappeared completely... I closed MetaTrader, and then relaunched MetaEditor...

I added back in extern - recompiled again - and then relaunched MetaTrader - the variables were added back into the EA - and the variables had been updated to the new variable settings...

 So - it worked - THANKS A TON!  :)  Soopa stahs!  

 
whistler: WHRoeder... I'm still a little confused to what you are saying...
This
Same as
// #define EXTERN extern
EXTERN typename var1=...;
EXTERN typename var2=...;
typename var1=...;
typename var2=...;
#define EXTERN extern
EXTERN typename var1=...;
EXTERN typename var2=...;
extern typename var1=...;
extern typename var2=...;
#define EXTERN /*EMPTY*/
EXTERN typename var1=...;
EXTERN typename var2=...;
typename var1=...;
typename var2=...;
 

Hi!

After re-compiling (F5), go to EA, open Inputs (F7) - there is 'Reset' button at bottom right. Clicking this resets EA to (hard-)coded values.

It took me a while to figure this out... LOL. Miracles do happen. So does s**t. LOL

Best regards,

Simon

S love nia