Download MetaTrader 5
To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
winterz
104
winterz 2015.02.18 17: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 :) 

whroeder1
13627
whroeder1 2015.02.18 18: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) );
winterz
104
winterz 2015.02.18 21:28  
Thaks WHRoeder!
rocketman99
122
rocketman99 2015.02.19 03: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
/
To add comments, please log in or register