Download MetaTrader 5

Smart way to turning off and on all Prints?

To add comments, please log in or register
winterz
104
winterz  

Just wondering if I could pick anyone's brain with regards to prints across ones algorithm?

 How would I turn all prints on and off with the "flick" of a button?

 Any thoughts, ideas or shove in the right direction would be nice :) 

whroeder1
14774
whroeder1  
input bool EnablePrint=true;
void PrintMe(string s){ if(EnablePrint) Print(s); }
:
PrintMe( StringFormat("value=%f",value) );
        enum status {SC_LIVE, SC_VISUAL, SC_OPTIMIZER };
status  status_chart;
int OnInit(){   
   if      ( !IsTesting() )   status_chart   = SC_LIVE;
   else  if( IsVisualMode() ) status_chart   = SC_VISUAL;
   else{                      status_chart   = SC_OPTIMIZER;
}
void PrintMe(string s){ if(status_chart != SC_VISUAL) Print(s); }
:
PrintMe( StringFormat("value=%f",value) );
winterz
104
winterz  
Thaks WHRoeder!
rocketman99
122
rocketman99  
winterz:

Just wondering if I could pick anyone's brain with regards to prints across ones algorithm?

 How would I turn all prints on and off with the "flick" of a button?

 Any thoughts, ideas or shove in the right direction would be nice :) 

Use compile time defines. Saves having the overhead of doing "if" comparisons for every tick when not testing and EA is in production: https://docs.mql4.com/basis/preprosessor/conditional_compilation
To add comments, please log in or register