One Buffer Per Day

To add comments, please log in or register
Sajjad Hossain Sagor
36
Sajjad Hossain Sagor  

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...

William Roeder
23249
William Roeder  
  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])
To add comments, please log in or register