Need afl for TIME ALERT 12.00 to 1.30pm and 3.00 to 3.30pm

#1
Seniors please help me to get a simple afl, giving me sound signal when trading time reaches to 12.00pm, 1.30pm and 3.00pm.
Even if there is a chance of changing chart color background between 12.00pm to 1.30pm and 3.00pm to 3.30pm.
I need this to indicate the market action during this time period.

Appreciate good help

Regards
Raju
 

casoni

Well-Known Member
#2
Hello ,
check this .....


Plot(C,"",1,64);

// time slot
starttime = 091500;
endtime = 101500;
timecond1 = TimeNum() >= starttime AND TimeNum() <= endtime;
Plot(timecond1, "", colorDarkGrey, styleArea|styleOwnScale,0,1);

starttime2 = 103000;
endtime2 = 113000;
timecond2 = TimeNum() >= starttime2 AND TimeNum() <= endtime2;
Plot(timecond2, "", colorGrey40, styleArea|styleOwnScale,0,1);

// sound alert at given time
pm12=Cross(TimeNum(),120000);
pm1330=Cross(TimeNum(),133000);
pm15=Cross(TimeNum(),150000);
AlertIF( pm12, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
AlertIF( pm1330, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );
AlertIF( pm15, "SOUND C:\\Windows\\Media\\Ding.wav", "Audio alert", 2 );

//from 12.00pm to 1.30pm it will green
//from 3.00pm to 3.30pm it will be red
//for background chart color
//_day = Day()==LastValue(Day());
starttimex = 120000;
endtimex = 133000;
timecondx = (TimeNum() >= starttimex AND TimeNum() <= endtimex);
starttimey = 150000;
endtimey = 153000;
timecondy = (TimeNum() >= starttimey AND TimeNum() <= endtimey);
bgcolor=IIf(LastValue(timecondx),colordarkgreen,IIf(LastValue(timecondy),colorDarkRed,2));
SetChartBkGradientFill( colorTan, bgColor);