One Buffer Per Day

 

I have an indicator which gives one signal Down Buffer... I wish to only give signal once per day... Like after the first signal it will not paint any signal for the rest of the day! I have tested with below code it's now not painting at all?


int day = 0; // this goes in OnInit()

//here goes my signal conditions

if( day != Day() ) //inside OnCalculate()
{
   Buffer1[i] = High[i] + iATR(NULL, PERIOD_CURRENT, 14, i);
   day = Day();
}

What am i doing wrong? It's now not showing any signal at all...

 
  1. int day = 0; // this goes in OnInit()
    If that is actually in your OnInit, then your code can't compile or you defined another day inside your OnCalculate.
  2. You are running in a loop (i) but using the current time for your "day".
  3. Try TimeDay(Time[i]) != TimeDay(Time[i+1])
Reason: