/* afl that can plot
Lines for Day before yesterday and yesterdays Open,High,Low,Close values ..
D1=Yesterday (line in white colour)
D2=Day before yesterday (line in yellow colour).
*/
_SECTION_BEGIN("Price");
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() );
Plot(O, "Open", colorBlack, styleHidden);
_SECTION_END();
ShowD1OHLC= ParamToggle("ShowD1OHLC", "No|Yes", 1);
ShowD2OHLC= ParamToggle("ShowD2OHLC", "No|Yes", 1);
numbars= LastValue(Cum(Status("barvisible")));
hts= -33.5;
dt= DateTime() ;
dtnum= DateTimeConvert(0, dt) ;
isNewDt= dtnum != Ref(dtnum, -1) ;
isLastbar= H-H ;
isLastbar= dtnum != Ref(dtnum, 1) ;
_SECTION_BEGIN("Last 2 days H/L");
D1OColor= ParamColor("D1OColor", colorWhite);
D1HColor= ParamColor("D1HColor", colorWhite);
D1LColor= ParamColor("D1LColor", colorWhite);
D1CColor= ParamColor("D1CColor", colorWhite);
D2OColor= ParamColor("D2OColor", colorYellow);
D2HColor= ParamColor("D2HColor", colorYellow);
D2LColor= ParamColor("D2LColor", colorYellow);
D2CColor= ParamColor("D2CColor", colorYellow);
D1OStyle= ParamStyle("D1OStyle", styleDashed|styleNoLabel|styleNoRescale);
D1HStyle= ParamStyle("D1HStyle", styleDashed|styleNoLabel|styleNoRescale);
D1LStyle= ParamStyle("D1LStyle", styleDashed|styleNoLabel|styleNoRescale);
D1CStyle= ParamStyle("D1CStyle", styleThick|styleNoLabel|styleNoRescale);
D2OStyle= ParamStyle("D2OStyle", styleDashed|styleNoLabel|styleNoRescale);
D2HStyle= ParamStyle("D2HStyle", styleDashed|styleNoLabel|styleNoRescale);
D2LStyle= ParamStyle("D2LStyle", styleDashed|styleNoLabel|styleNoRescale);
D2CStyle= ParamStyle("D2CStyle", styleDashed|styleNoLabel|styleNoRescale);
if(ShowD1OHLC)
{
D1O= TimeFrameGetPrice("O", inDaily, -1);
D1H= TimeFrameGetPrice("H", inDaily, -1);
D1L= TimeFrameGetPrice("L", inDaily, -1);
D1C= TimeFrameGetPrice("C", inDaily, -1);
Plot(IIf(isLastbar,Null,D1O), "D1O", D1OColor, D1OStyle);
Plot(IIf(isLastbar,Null,D1H), "D1H", D1HColor, D1HStyle);
Plot(IIf(isLastbar,Null,D1L), "D1L", D1LColor, D1LStyle);
Plot(IIf(isLastbar,Null,D1C), "D1C", D1CColor, D1CStyle);
PlotText("D1O ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1O,1), D1OColor);
PlotText("D1H ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1H,1), D1HColor);
PlotText("D1L ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1L,1), D1LColor);
PlotText("D1C ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1C,1), D1CColor);
}
if(ShowD2OHLC)
{
D2O= TimeFrameGetPrice("O", inDaily, -2);
D2H= TimeFrameGetPrice("H", inDaily, -2);
D2L= TimeFrameGetPrice("L", inDaily, -2);
D2C= TimeFrameGetPrice("C", inDaily, -2);
Plot(IIf(isLastbar,Null,D2O), "D2O", D2OColor, D2OStyle);
Plot(IIf(isLastbar,Null,D2H), "D2H", D2HColor, D2HStyle);
Plot(IIf(isLastbar,Null,D2L), "D2L", D2LColor, D2LStyle);
Plot(IIf(isLastbar,Null,D2C), "D2C", D2CColor, D2CStyle);
PlotText("D2O ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2O,1), D2OColor);
PlotText("D2H ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2H,1), D2HColor);
PlotText("D2L ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2L,1), D2LColor);
PlotText("D2C ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2C,1), D2CColor);
}
_SECTION_END();
/* afl that can plot
Lines for Day before yesterday and yesterdays Open,High,Low,Close values ..
D1=Yesterday (line in white colour)
D2=Day before yesterday (line in yellow colour).
*/
_SECTION_BEGIN("Price");
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() );
Plot(O, "Open", colorBlack, styleHidden);
_SECTION_END();
ShowD1OHLC= ParamToggle("ShowD1OHLC", "No|Yes", 1);
ShowD2OHLC= ParamToggle("ShowD2OHLC", "No|Yes", 1);
numbars= LastValue(Cum(Status("barvisible")));
hts= -33.5;
dt= DateTime() ;
dtnum= DateTimeConvert(0, dt) ;
isNewDt= dtnum != Ref(dtnum, -1) ;
isLastbar= H-H ;
isLastbar= dtnum != Ref(dtnum, 1) ;
_SECTION_BEGIN("Last 2 days H/L");
D1OColor= ParamColor("D1OColor", colorWhite);
D1HColor= ParamColor("D1HColor", colorWhite);
D1LColor= ParamColor("D1LColor", colorWhite);
D1CColor= ParamColor("D1CColor", colorWhite);
D2OColor= ParamColor("D2OColor", colorYellow);
D2HColor= ParamColor("D2HColor", colorYellow);
D2LColor= ParamColor("D2LColor", colorYellow);
D2CColor= ParamColor("D2CColor", colorYellow);
D1OStyle= ParamStyle("D1OStyle", styleDashed|styleNoLabel|styleNoRescale);
D1HStyle= ParamStyle("D1HStyle", styleDashed|styleNoLabel|styleNoRescale);
D1LStyle= ParamStyle("D1LStyle", styleDashed|styleNoLabel|styleNoRescale);
D1CStyle= ParamStyle("D1CStyle", styleThick|styleNoLabel|styleNoRescale);
D2OStyle= ParamStyle("D2OStyle", styleDashed|styleNoLabel|styleNoRescale);
D2HStyle= ParamStyle("D2HStyle", styleDashed|styleNoLabel|styleNoRescale);
D2LStyle= ParamStyle("D2LStyle", styleDashed|styleNoLabel|styleNoRescale);
D2CStyle= ParamStyle("D2CStyle", styleDashed|styleNoLabel|styleNoRescale);
if(ShowD1OHLC)
{
D1O= TimeFrameGetPrice("O", inDaily, -1);
D1H= TimeFrameGetPrice("H", inDaily, -1);
D1L= TimeFrameGetPrice("L", inDaily, -1);
D1C= TimeFrameGetPrice("C", inDaily, -1);
Plot(IIf(isLastbar,Null,D1O), "D1O", D1OColor, D1OStyle);
Plot(IIf(isLastbar,Null,D1H), "D1H", D1HColor, D1HStyle);
Plot(IIf(isLastbar,Null,D1L), "D1L", D1LColor, D1LStyle);
Plot(IIf(isLastbar,Null,D1C), "D1C", D1CColor, D1CStyle);
PlotText("D1O ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1O,1), D1OColor);
PlotText("D1H ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1H,1), D1HColor);
PlotText("D1L ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1L,1), D1LColor);
PlotText("D1C ", LastValue(BarIndex())-(numbars/Hts), LastValue(D1C,1), D1CColor);
}
if(ShowD2OHLC)
{
D2O= TimeFrameGetPrice("O", inDaily, -2);
D2H= TimeFrameGetPrice("H", inDaily, -2);
D2L= TimeFrameGetPrice("L", inDaily, -2);
D2C= TimeFrameGetPrice("C", inDaily, -2);
Plot(IIf(isLastbar,Null,D2O), "D2O", D2OColor, D2OStyle);
Plot(IIf(isLastbar,Null,D2H), "D2H", D2HColor, D2HStyle);
Plot(IIf(isLastbar,Null,D2L), "D2L", D2LColor, D2LStyle);
Plot(IIf(isLastbar,Null,D2C), "D2C", D2CColor, D2CStyle);
PlotText("D2O ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2O,1), D2OColor);
PlotText("D2H ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2H,1), D2HColor);
PlotText("D2L ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2L,1), D2LColor);
PlotText("D2C ", LastValue(BarIndex())-(numbars/Hts), LastValue(D2C,1), D2CColor);
}
_SECTION_END();
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
E | Help needed - Export minute data to hourly OHLC | AmiBroker | 2 | |
K | OHLC Afl Code needed | AmiBroker | 5 | |
S | Help Need for OHLC | Development of Software Utilities | 2 | |
Need OHLC of Nifty fut | Data Feeds | 1 | ||
B | Need OHLC and Vol of all NSE cash scrips during mkt hours | Intraday | 0 |