I would like to have an indicator that I can leave open on the daily chart but it monitors all timeframes below it.
How can I get the close of a timeframe with set period?
if(Period()==PERIOD_D1||Period()==PERIOD_H4||Period()==PERIOD_H1){if(Period()==PERIOD_D1){if(Close[1]> SpanA_Buffer[0]&&Close[1]> SpanB_Buffer[0]&& DailyLastAlert !=1){Alert("Price closed above the cloud on "+Symbol()+": "+Period());
DailyLastAlert =1;//buy was last alert}if(Close[1]< SpanA_Buffer[0]&&Close[1]< SpanB_Buffer[0]&& DailyLastAlert !=0){Alert("Price closed below the cloud on "+Symbol()+": "+Period());
DailyLastAlert =0;//buy was last alert}}if(Period()==PERIOD_H4){if(Close[1]> SpanA_Buffer[0]&&Close[1]> SpanB_Buffer[0]&& FourHourLastAlert !=1){Alert("Price closed above the cloud on "+Symbol()+": "+Period());
FourHourLastAlert =1;//buy was last alert}if(Close[1]< SpanA_Buffer[0]&&Close[1]< SpanB_Buffer[0]&& FourHourLastAlert !=0){Alert("Price closed below the cloud on "+Symbol()+": "+Period());
FourHourLastAlert =0;//buy was last alert}}if(Period()==PERIOD_H1){if(Close[1]> SpanA_Buffer[0]&&Close[1]> SpanB_Buffer[0]&& HourLastAlert !=1){Alert("Price closed above the cloud on "+Symbol()+": "+Period());
HourLastAlert =1;//buy was last alert}if(Close[1]< SpanA_Buffer[0]&&Close[1]< SpanB_Buffer[0]&& HourLastAlert !=0){Alert("Price closed below the cloud on "+Symbol()+": "+Period());
HourLastAlert =0;//buy was last alert}}}
I would like to have an indicator that I can leave open on the daily chart but it monitors all timeframes below it.
How can I get the close of a timeframe with set period?