How to work 'Open prices only'

To add comments, please log in or register
David Diez
1405
David Diez  

Hello traders, I tried using this but it doesn't catch all the trades:

if(Volume[0]>1){return;}

I wonder if there is any other method for working 'Open prices only', cause optimization would be much more faster.

KEENBASE SOFTWARE SOLUTIONS
21151
Nitin Raj  

HI David,

I think by working"Open prices only" you want to execute the code only once per bar, you can use the following function to achieve the purpose.

static datetime bar_time=0; 

bool New_Bar()

{
 if(bar_time!=iTime(_Symbol,0,0))
  {
   bar_time=iTime(_Symbol,0,0);
   return true;
  } 

 return false;

}

To add comments, please log in or register