Smart way to turning off and on all Prints?

Back to topics list To post a new topic, please log in or register
avatar
36
winterz 2015.02.18 18:15
 

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

avatar
12985
WHRoeder 2015.02.18 19:49 #
 
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) );

avatar
36
winterz 2015.02.18 22:28 #
 
Thaks WHRoeder!
avatar
99
rocketman99 2015.02.19 04:31 #
 
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
Back to topics list  

To add comments, please log in or register