Re: Multiple Timeframe for Amibroker
Both postings above are repetitions cycling for ages in different forums....the above AFL is not a good effort, the first post has a variant with more TF added ....but good...
SetChartBkGradientFill(colorWhite,colorLightGrey,colorWhite);
Period= ParamList("Base","Monthly|Weekly|Daily|Hourly|15Minute|5Minute|1Minute",0);
if(Period=="Monthly"){
TimeFrameSet(inMonthly);
PlotOHLC(Open, High, Low, Close, "Monthly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Weekly"){
TimeFrameSet(inWeekly);
PlotOHLC(Open, High, Low, Close, "weekly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Daily"){
TimeFrameSet(inDaily);
PlotOHLC(Open, High, Low, Close, "Daily Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Hourly"){
TimeFrameSet(inHourly);
PlotOHLC(Open, High, Low, Close, "Hourly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="15Minute"){
TimeFrameSet(in15Minute);
PlotOHLC(Open, High, Low, Close, "15Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="5Minute"){
TimeFrameSet(in5Minute);
PlotOHLC(Open, High, Low, Close, "5Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="1Minute"){
TimeFrameSet(in1Minute);
PlotOHLC(Open, High, Low, Close, "1Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
Period= ParamList("Base","Monthly|Weekly|Daily|Hourly|15Minute|5Minute|1Minute",0);
if(Period=="Monthly"){
TimeFrameSet(inMonthly);
PlotOHLC(Open, High, Low, Close, "Monthly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Weekly"){
TimeFrameSet(inWeekly);
PlotOHLC(Open, High, Low, Close, "weekly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Daily"){
TimeFrameSet(inDaily);
PlotOHLC(Open, High, Low, Close, "Daily Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="Hourly"){
TimeFrameSet(inHourly);
PlotOHLC(Open, High, Low, Close, "Hourly Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="15Minute"){
TimeFrameSet(in15Minute);
PlotOHLC(Open, High, Low, Close, "15Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="5Minute"){
TimeFrameSet(in5Minute);
PlotOHLC(Open, High, Low, Close, "5Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
if(Period=="1Minute"){
TimeFrameSet(in1Minute);
PlotOHLC(Open, High, Low, Close, "1Minute Price Chart", colorBlack, style = styleCandle | styleOwnScale);
Plot(V,"Volume",colorWhite, styleHistogram);
}
_SECTION_BEGIN("multiple timeframe");
n=Param("TM",1,1,60,1);
n_open = TimeFrameGetPrice("O",n*in1Minute);
n_high = TimeFrameGetPrice("H",n*in1Minute);
n_low = TimeFrameGetPrice("L",n*in1Minute);
n_close = TimeFrameGetPrice("C",n*in1Minute);
n_Open = TimeFrameCompress( n_Open, n*in1Minute );
n_High = TimeFrameCompress( n_High, n*in1Minute );
n_Low = TimeFrameCompress( n_Low, n*in1Minute );
n_Close = TimeFrameCompress( n_Close, n*in1Minute );
Color=IIf(C>O,colorYellow,colorBlue);
PlotOHLC(n_open,n_high,n_low,n_close,"n",color,styleCandle);
_SECTION_END();
n=Param("TM",1,1,60,1);
n_open = TimeFrameGetPrice("O",n*in1Minute);
n_high = TimeFrameGetPrice("H",n*in1Minute);
n_low = TimeFrameGetPrice("L",n*in1Minute);
n_close = TimeFrameGetPrice("C",n*in1Minute);
n_Open = TimeFrameCompress( n_Open, n*in1Minute );
n_High = TimeFrameCompress( n_High, n*in1Minute );
n_Low = TimeFrameCompress( n_Low, n*in1Minute );
n_Close = TimeFrameCompress( n_Close, n*in1Minute );
Color=IIf(C>O,colorYellow,colorBlue);
PlotOHLC(n_open,n_high,n_low,n_close,"n",color,styleCandle);
_SECTION_END();
Last edited: