Bar Close and Tick

 

I'm using bar closes to signal an entry on my EA. Once in the position I want to monitor the position by tick so I can adjust a trailing stop.

Currently I'm using the following code in the EA to so I can get a signal on a close from a function that looks at an iCustom indicator. Is there another way to call the function and check iCustom on bar closes then use ticks for everything else?

datetime timeprev=0;
int start()
  {
  if(timeprev==Time[0])
  return(0);
  timeprev=Time[0];
 

You just need a small mod to your code . . .

datetime timeprev=0;

int start()
  {
  if(timeprev!=Time[0])
    {
    variable = iCustom( . . . . . );
    timeprev=Time[0];
    }

// code that is executed for every tick goes here

  return(0);
  }  // end of start()
 
Here is some helpful code. Yeah, place the trade logic within the newbar check. Let everything else run on default (ticks).
 

Of course it was right in front of me... :-) Once again you guys are awesome!

Reason: