what can i do ?

 

Can someome help me on this matter? i want my ea to be placing order at the closing of candle (i.e formation of a new candle ) i have used this formular :


bool Fun_New_Bar()
{
static datetime New_Time=0;
bool New_Bar=false;
if(New_Time!=Time[0])
{
New_Time=Time[0];
New_Bar=true;
return(New_Bar);
}
return(false);
}

but it didnt work this formular places order while the candle has not closed. Pls what can i do?

 

KL
Something like this

static datetime LastTradeBarTime;




int init()
  {
//----


  LastTradeBarTime = Time[1]; // initialise the variable




//----
   return(0);
  }


start()
{

  // Do <any tick> code here such as trailing stops etc





  if (LastTradeBarTime == Time[0]) return(0); // Not <first detected tick> on this bar so quit

  else LastTradeBarTime = Time[0]; // and continue

  // Do <once per bar> trading stuff here




   return (0);
  }


Good Luck
-BB-

 

Look for your last post. We have already explained you.

Reason: