Smart way to turning off and on all Prints?

 

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 :) 

 
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) );
 
Thaks WHRoeder!
 
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
Reason: