Is it possible to emulate control points?

 

I know that it is quite possible (and often beneficial) to emulate the "Open Bars" testing mode. All you need is something like this:

if (Bars = lastBar) return(0);
lastBar = Bars;

How about control points?

 

Control points do not exist, they don't correspond to real prices or real events. They are simulated.


Your method is basically ok, I do the same, but I would consider using Time[0] instead of Bars. I usually have something like this in my EAs:

void onTick(){
}

void onOpen(){
}

int start(){
   static int last_time;
   onTick();
   if (Time[0] == last_time){
      return(0);
   }
   last_time = Time[0];
   onOpen();
   return(0);
}
 
I like the way you call two different functions depending on if its a tick or an open bar. Why do you recommend using Time[0] instead? I can't think of an instance when the two would differ.
 
when Bars reaches max bars per chart it might not change anymore (not sure, never actually tried it, but it would make sense)
 
mfurlend:

I know that it is quite possible (and often beneficial) to emulate the "Open Bars" testing mode. All you need is something like this:

if (Bars = lastBar) return(0);
lastBar = Bars;

Won't work once Bars = max bars in chart.

static datetime Time0;
bool New_Bar = Time0 < Time[0]; Time0 = Time[0];
if (New_Bar){...
 
Wow, I can't believe I didn't realize that! Thanks for the info.