Hello!
Can anyone help to write Trade Script codes for Zerodha Pi scanner for below given condition:
Latest close crossed above 1 day ago high + ((1 day ago high - 1 day ago low)*0.25)
Hello!
Can anyone help to write Trade Script codes for Zerodha Pi scanner for below given condition:
Latest close crossed above 1 day ago high + ((1 day ago high - 1 day ago low)*0.25)
Skeleton AFL is as follows.
//written by kamal.delhi.india @ gmail
_SECTION_BEGIN("TradingQNA");
pDayH = TimeFrameGetPrice("H", inDaily,-1);
pDayL = TimeFrameGetPrice("L", inDaily,-1);
Buy=Sell=0;
buyopen=0;
sellopen=0;
t=TimeNum();tt=int(t/100);
for (i = 1; i < BarCount ; i++) {
if ( tt[i] >= 915 AND tt[i] <= 1500 AND buyopen==0)
{
Buy[i] = C[i] > (pDayH[i] + (pDayH[i]-pDayL[i])*0.25);
if(Buy[i] == true)
{
buyopen=1;
sellopen=0;
}
}
if ( tt[i] > 1500 AND sellopen==0)
{
Sell[i] = 1;
buyopen = 0;
sellopen = 1;
}
}
Filter = Buy OR Sell;
PlotShapes( Buy * shapeUpArrow + Sell * shapeDownArrow, IIf( Buy, colorGreen, colorRed ) );
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
Thanks a lot. Hope this will work.