hi,
I coded this. Have a look. I didn't test it properly yet but should work. If you change the timeframe you need to reset the static variables => right click mouse, Parameters button and then push "Reset Static Vars". Also you need to set the startime and endtime for your liking.
let me know if it works,
regards, Ed
// initialisations
starttime = 093000;
endtime = 160000;
timecond = TimeNum() >= starttime AND TimeNum() <= endtime;
firstBarOfDay = TimeNum() >= starttime ;firstBarOfDay = firstBarOfDay - Ref(firstBarOfDay, -1);
// function to observe
FF = RSI(14);
// calculations
HighFF = ValueWhen( timecond, HighestSince( firstBarOfDay, FF) );
LowFF = ValueWhen( timecond, LowestSince( firstBarOfDay, FF) );
HighFF =
TimeFrameCompress(HighFF, inDaily, compressLast);
LowFF = TimeFrameCompress(LowFF, inDaily, compressLast);
HighFF = TimeFrameExpand( HighFF, inDaily, expandFirst );
LowFF = TimeFrameExpand( LowFF, inDaily, expandFirst );
// chart section
SetChartBkColor( ParamColor("Color1",ColorRGB(0,0,0)));
GraphXSpace = 5;
SetChartOptions(0, chartShowDates);
Plot(FF,"\nFF",ParamColor("Color2",ColorRGB(255,100,0)),styleLine);
Plot(HighFF,"\nHighFF",ParamColor("Color3",ColorRGB(255,0,255)),styleDashed);
Plot(LowFF,"\nLowFF",ParamColor("Color4",ColorRGB(255,0,255)),styleDashed);
Plot(timecond, "", ParamColor("Color5",ColorRGB(60,60,60)), styleArea|styleOwnScale,0,1);
// alert section
staticHigh = Nz(StaticVarGet("sh"));
staticLow = Nz(StaticVarGet("sl"));
"Last High: " + WriteVal(staticHigh) ;
"Last Low: " + WriteVal(staticLow);
"Timecond: " + WriteVal(LastValue(timecond));
// reset static vars
rstep = ParamTrigger("Reset Static Vars:", "Reset Static Vars");
if(rstep)
{
StaticVarSet( "sh",0);
StaticVarSet( "sl",0);
}
if (LastValue(FF) >= staticHigh AND LastValue(timecond))
{
StaticVarSet("sh",Max(LastValue(FF),LastValue(HighFF)) );
// new high alert
Say( "New High" );
}
if ( (LastValue(FF) <= staticLow OR staticLow == 0) AND LastValue(timecond))
{
StaticVarSet("sl",Min(LastValue(FF),LastValue(LowFF)) );
// new low alert
Say( "New Low" );
}
SetBarsRequired(sbrAll,sbrAll);
----- Original Message -----
Sent: Friday, January 15, 2010 6:03 AM
Subject: [amibroker] Can this be written = Complicated i thought
I want to write the lowest value and the highest value of the day for RSI in real time.
The value should change if the earlier low or high is breached.
Then I must get a alert if a new high or low is acheived.
Deepak Patade,
Nasik.