manishchan
Attached latest picture.Will get the EMA.But the Vwap lines and other lines are not visible.Sorry for bothering again.
Attached latest picture.Will get the EMA.But the Vwap lines and other lines are not visible.Sorry for bothering again.
Edit : The AFL is very flexible. After you lay it out, just go to param and explore all the options, you will hang of how you can change things.
PHP:
_SECTION_BEGIN("HighVol");
SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle);
SetChartBkColor(ParamColor("Background", colorLightGrey)) ;
Layer = Param("Layer", 0, -5, 5, 1) ;
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} " + EncodeColor( colorGreen ) + " Open %g," + EncodeColor( colorBlue ) + " Hi %g, " + EncodeColor( colorRed ) + " Lo %g, " + EncodeColor( colorBlack ) + " Close %g (%.1f%%){{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", colorBlack, styleNoTitle | styleCandle,0,0,0,Layer );
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;
//Peaking Volumes
HiVolume = IIf(V > (2 * MA(V,10)), True, False);
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorBlack, colorWhite), 0, (O+C)/2, 0);
_SECTION_END();
_SECTION_BEGIN("Pratap_SRSARTFtj");
usetf = ParamToggle("Use TF", "No|Yes", 1) ;
// Author: Pratap Balakrishnan
// Copyright: All rights reserved. Not to be circulated or shared or posted on websites without the author's written permission.
// email id: [email protected]
//
/*
This creates a band of period-moving average for the given TF
(TF should be equal to or higher than current chart TF).
*/
alloff = ParamToggle("All off", "No|Yes", 0) ;
// Rh = ParamField("High", 1) ;
// Rl = ParamField("Low", 2) ;
tf = Param("TF", 3, 1, 100000, 1);
Periods = Param("Periods", 13, 2, 1000, 1 );
showzone = ParamToggle("Show Zone", "No|Yes", 1) ;
Layer = Param("Layer", -2, -5, 5, 1) ;
shift = Param("Shift", 0, -100, 100, 1) ;
showtitle = ParamToggle("Show Title", "No|Yes", 0) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;
isema = ParamToggle("MA Type", "MA|EMA", 1) ;
MAstyle = ParamStyle("MA Style", styleThick|styleDashed) ;
MAwidthper = Param("MA Width %", 0, 0, 10, 1) ;
MAwidth = SelectedValue(C) * MAwidthper /100 ;
Clrup = ParamColor( "Color Up", colorTurquoise);
Clrdown = ParamColor( "Color Down", colorRose);
Clrsw = ParamColor( "Color SW", colorLavender);
isexpandLast = ParamToggle("Expand Mode", "First|Last", 0);
styledisp = 0 ;
if (NOT showtitle)
styledisp |= styleNoTitle ;
if (NOT showlabel)
styledisp |= styleNoLabel ;
expandmode = expandFirst ;
if (isexpandLast)
expandmode = expandLast ;
if (NOT alloff)
{
Oldintrvl = Interval() ;
if (usetf)
{
tfs = tf *in1Minute ;
TimeFrameSet(tfs) ;
}
else
tfs = Interval() ;
if (isema)
MAhtf = EMA(H, Periods) ;
else
MAhtf = MA(H, Periods) ;
if (isema)
MAltf = EMA(L, Periods) ;
else
MAltf = MA(L, Periods) ;
str = NumToStr(tf, 1.0)+"Min"+"-P"+NumToStr(Periods, 1.0) ;
Clr = IIf(MAltf > Ref(MAltf, -1 ), ClrUp,
IIf(MAhtf < Ref(MAhtf, -1 ), ClrDown,
Clrsw)) ;
if (usetf)
TimeFrameRestore() ; //TimeFrameSet(Oldintrvl) ;
if (usetf)
MAhtfe = TimeFrameExpand(MAhtf, tfs, expandmode ) ;
else
MAhtfe = MAhtf ;
if (usetf)
MAltfe = TimeFrameExpand(MAltf, tfs, expandmode ) ;
else
MAltfe = MAltf ;
if (usetf)
Clre = TimeFrameExpand(Clr, tfs, expandmode ) ;
else
Clre = Clr ;
RefMAhtfe = MAhtfe ;
RefMAltfe = MAltfe ;
RefClre = Clre ;
Plot( RefMAhtfe, str+" High", RefClre, MAstyle|styledisp|styleNoRescale, 0, 0, shift, 1 );
Plot( RefMAltfe, str+" Low", RefClre, MAstyle|styledisp|styleNoRescale, 0, 0, shift, 1 );
if (showzone)
PlotOHLC(RefMAhtfe, RefMAhtfe, RefMAltfe, RefMAltfe, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale,Null, Null, shift, Layer) ;
if (MAwidth > 0)
{
PlotOHLC(RefMAhtfe+MAwidth, RefMAhtfe+MAwidth, RefMAhtfe-MAwidth, RefMAhtfe-MAwidth, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale,Null, Null, shift) ;
PlotOHLC(RefMAltfe+MAwidth, RefMAltfe+MAwidth, RefMAltfe-MAwidth, RefMAltfe-MAwidth, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale,Null, Null, shift) ;
}
showext = ParamToggle("Show Extension", "No|Yes", 1) ;
showextband = ParamToggle("Show Extension Band", "No|Yes", 1) ;
extend = Param("Extend", 20, 0, 100, 1) ;
showparam = ParamToggle("Show Key Param", "No|Yes", 1) ;
if (showext)
{
x0 = BarCount - (extend+1) ;
x1 = BarCount -1 ;
Hdlast = SelectedValue(RefMAhtfe) ;
Ldlast = SelectedValue(RefMAltfe) ;
Hplot = LineArray(x0, Hdlast, x1, Hdlast) ;
Plot(Hplot, "", RefClre, styleLine|styleNoLabel|styledisp|styleNoRescale, 0,0,extend) ;
LPlot = LineArray(x0, Ldlast, x1, Ldlast) ;
Plot(LPlot, "", RefClre, styleLine|styleNoLabel|styledisp|styleNoRescale, 0,0,extend) ;
if (showextband)
PlotOHLC(HPlot, HPlot, LPlot, LPlot, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale, 0,0,extend,Layer ) ;
}
showparam = ParamToggle("Show Key Param", "No|Yes", 0) ;
if (showparam)
{
y = (SelectedValue(RefMAhtfe)+ SelectedValue(RefMAltfe)) /2 ;
tfsd = tfs ;
if (tfsd < Interval())
tfsd = Interval() ;
str = "TF = " + NumToStr(tfsd/in1Minute, 1.0) + " P = " + NumToStr(Periods, 1.0) ;
PlotText(str, BarCount+2, y, colorBlack) ;
}
}
_SECTION_END();
_SECTION_BEGIN("Pratap_SRSARTFtj60min");
usetf = ParamToggle("Use TF", "No|Yes", 1) ;
// Author: Pratap Balakrishnan
// Copyright: All rights reserved. Not to be circulated or shared or posted on websites without the author's written permission.
// email id: [email protected]
//
/*
This creates a band of period-moving average for the given TF
(TF should be equal to or higher than current chart TF).
*/
alloff = ParamToggle("All off", "No|Yes", 0) ;
// Rh = ParamField("High", 1) ;
// Rl = ParamField("Low", 2) ;
tf = Param("TF", 60, 1, 100000, 1);
Periods = Param("Periods", 13, 2, 1000, 1 );
showzone = ParamToggle("Show Zone", "No|Yes", 0) ;
Layer = Param("Layer", -2, -5, 5, 1) ;
shift = Param("Shift", 0, -100, 100, 1) ;
showtitle = ParamToggle("Show Title", "No|Yes", 0) ;
showlabel = ParamToggle("Show Label", "No|Yes", 1) ;
isema = ParamToggle("MA Type", "MA|EMA", 1) ;
MAstyle = ParamStyle("MA Style", styleThick|styleDashed) ;
MAwidthper = Param("MA Width %", 0.01, 0, 10, 1) ;
MAwidth = SelectedValue(C) * MAwidthper /100 ;
Clrup = ParamColor( "Color Up", colorBrown);
Clrdown = ParamColor( "Color Down", colorBrown);
Clrsw = ParamColor( "Color SW", colorBrown);
isexpandLast = ParamToggle("Expand Mode", "First|Last", 0);
styledisp = 0 ;
if (NOT showtitle)
styledisp |= styleNoTitle ;
if (NOT showlabel)
styledisp |= styleNoLabel ;
expandmode = expandFirst ;
if (isexpandLast)
expandmode = expandLast ;
if (NOT alloff)
{
Oldintrvl = Interval() ;
if (usetf)
{
tfs = tf *in1Minute ;
TimeFrameSet(tfs) ;
}
else
tfs = Interval() ;
if (isema)
MAhtf = EMA(H, Periods) ;
else
MAhtf = MA(H, Periods) ;
if (isema)
MAltf = EMA(L, Periods) ;
else
MAltf = MA(L, Periods) ;
str = NumToStr(tf, 1.0)+"Min"+"-P"+NumToStr(Periods, 1.0) ;
Clr = IIf(MAltf > Ref(MAltf, -1 ), ClrUp,
IIf(MAhtf < Ref(MAhtf, -1 ), ClrDown,
Clrsw)) ;
if (usetf)
TimeFrameRestore() ; //TimeFrameSet(Oldintrvl) ;
if (usetf)
MAhtfe = TimeFrameExpand(MAhtf, tfs, expandmode ) ;
else
MAhtfe = MAhtf ;
if (usetf)
MAltfe = TimeFrameExpand(MAltf, tfs, expandmode ) ;
else
MAltfe = MAltf ;
if (usetf)
Clre = TimeFrameExpand(Clr, tfs, expandmode ) ;
else
Clre = Clr ;
RefMAhtfe = MAhtfe ;
RefMAltfe = MAltfe ;
RefClre = Clre ;
Plot( RefMAhtfe, str+" High", RefClre, MAstyle|styledisp|styleNoRescale, 0, 0, shift, 1 );
Plot( RefMAltfe, str+" Low", RefClre, MAstyle|styledisp|styleNoRescale, 0, 0, shift, 1 );
if (showzone)
PlotOHLC(RefMAhtfe, RefMAhtfe, RefMAltfe, RefMAltfe, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale,Null, Null, shift, Layer) ;
if (MAwidth > 0)
{
PlotOHLC(RefMAhtfe+MAwidth, RefMAhtfe+MAwidth, RefMAhtfe-MAwidth, RefMAhtfe-MAwidth, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale,Null, Null, shift) ;
PlotOHLC(RefMAltfe+MAwidth, RefMAltfe+MAwidth, RefMAltfe-MAwidth, RefMAltfe-MAwidth, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale,Null, Null, shift) ;
}
showext = ParamToggle("Show Extension", "No|Yes", 1) ;
showextband = ParamToggle("Show Extension Band", "No|Yes", 1) ;
extend = Param("Extend", 20, 0, 100, 1) ;
showparam = ParamToggle("Show Key Param", "No|Yes", 1) ;
if (showext)
{
x0 = BarCount - (extend+1) ;
x1 = BarCount -1 ;
Hdlast = SelectedValue(RefMAhtfe) ;
Ldlast = SelectedValue(RefMAltfe) ;
Hplot = LineArray(x0, Hdlast, x1, Hdlast) ;
Plot(Hplot, "", RefClre, styleLine|styleNoLabel|styledisp|styleNoRescale, 0,0,extend) ;
LPlot = LineArray(x0, Ldlast, x1, Ldlast) ;
Plot(LPlot, "", RefClre, styleLine|styleNoLabel|styledisp|styleNoRescale, 0,0,extend) ;
if (showextband)
PlotOHLC(HPlot, HPlot, LPlot, LPlot, "", RefClre, styleCloud|styleNoLabel|styledisp|styleNoRescale, 0,0,extend,Layer ) ;
}
showparam = ParamToggle("Show Key Param", "No|Yes", 0) ;
if (showparam)
{
y = (SelectedValue(RefMAhtfe)+ SelectedValue(RefMAltfe)) /2 ;
tfsd = tfs ;
if (tfsd < Interval())
tfsd = Interval() ;
str = "TF = " + NumToStr(tfsd/in1Minute, 1.0) + " P = " + NumToStr(Periods, 1.0) ;
PlotText(str, BarCount+2, y, colorBlack) ;
}
}
_SECTION_END();
_SECTION_BEGIN("Daily SR");
showprevday = ParamToggle("Show Prev Day Levels", "No|Yes", 1) ;
showprev2day = ParamToggle("Show Two Prev Day Levels", "No|Yes", 1) ;
showprevweek = ParamToggle("Show Prev Week Levels", "No|Yes", 1) ;
showrollweek = ParamToggle("Show Rolling Week Levels", "No|Yes", 1) ;
showextensiononly = ParamToggle("Show Extension Only", "No|Yes", 1) ;
showfloorpvt = ParamToggle("Show Floor Pivot", "No|Yes", 1) ;
extend = Param("Extend By", 20, 0, 200, 1) ;
x0 = BarCount - (extend+1) ;
x1 = BarCount -1 ;
if (showprevday)
{
Hd = TimeFrameGetPrice("H", inDaily, 0,expandLast) ;
Ld = TimeFrameGetPrice("L", inDaily, 0,expandLast) ;
Cd = TimeFrameGetPrice("C", inDaily, 0,expandLast) ;
pvtd = (Hd+Ld+Cd) / 3 ;
/*
S1 = (2*pvtd )-Hd;
R1 = (2*pvtd )-Ld;
S2 = pvtd -(Hd - Ld);
S3 = S1 - (Hd-Ld);
R2 = pvtd +(Hd - Ld);
R3 = R1 +(Hd-Ld);
*/
Clrperiodhigh = ParamColor("Color Daily High", colorRed) ;
Clrperiodlow = ParamColor("Color Daily Low", colorBlue) ;
Clrperiodclose = ParamColor("Color Daily Close", colorBlack) ;
Clrfloorpvt = ParamColor("Color Daily Pivot", colorGold) ;
if (NOT showextensiononly)
{
Plot(Hd, "", Clrperiodhigh , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
Plot(Ld, "", Clrperiodlow , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
Plot(Cd, "", Clrperiodclose , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
if (showfloorpvt)
Plot(pvtd, "", Clrfloorpvt, styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
}
Hdlast = SelectedValue(Hd) ;
Ldlast = SelectedValue(Ld) ;
Cdlast = SelectedValue(Cd) ;
pvtdlast = SelectedValue(pvtd) ;
Hplot = LineArray(x0, Hdlast, x1, Hdlast) ;
Plot(Hplot, "", Clrperiodhigh , styleLine|styleDots|styleNoRescale, 0,0,extend) ;
LPlot = LineArray(x0, Ldlast, x1, Ldlast) ;
Plot(LPlot, "", Clrperiodlow , styleLine|styleDots|styleNoRescale, 0,0,extend) ;
CPlot = LineArray(x0, Cdlast, x1, Cdlast) ;
Plot(CPlot, "", Clrperiodclose , styleLine|styleDots|styleNoRescale, 0,0,extend) ;
if (showfloorpvt)
{
pvtdPlot = LineArray(x0, pvtdlast, x1, pvtdlast) ;
Plot(pvtdPlot, "", Clrfloorpvt, styleLine|styleDots|styleNoRescale, 0,0,extend) ;
}
}
if (showprev2day)
{
Hd2 = TimeFrameGetPrice("H", inDaily, -1,expandLast) ;
Ld2 = TimeFrameGetPrice("L", inDaily, -1,expandLast) ;
Cd2 = TimeFrameGetPrice("C", inDaily, -1,expandLast) ;
if (NOT showextensiononly)
{
Plot(Hd2, "", Clrperiodhigh , styleThick|styleStaircase|styleNoRescale|styleNoLabel) ;
Plot(Ld2, "", Clrperiodlow , styleThick|styleStaircase|styleNoRescale|styleNoLabel) ;
Plot(Cd2, "", Clrperiodclose , styleThick|styleStaircase|styleNoRescale|styleNoLabel) ;
}
Hd2last = SelectedValue(Hd2) ;
Ld2last = SelectedValue(Ld2) ;
Cd2last = SelectedValue(Cd2) ;
Hplot = LineArray(x0, Hd2last, x1, Hd2last) ;
Plot(Hplot, "", Clrperiodhigh , styleLine|styleNoRescale, 0,0,extend) ;
LPlot = LineArray(x0, Ld2last, x1, Ld2last) ;
Plot(LPlot, "", Clrperiodlow , styleLine|styleNoRescale, 0,0,extend) ;
CPlot = LineArray(x0, Cd2last, x1, Cd2last) ;
Plot(CPlot, "", Clrperiodclose , styleLine|styleNoRescale, 0,0,extend) ;
}
if (showprevweek)
{
Clrhigherperiodhigh = ParamColor("Color Weekly High", colorBrown) ;
Clrhigherperiodlow = ParamColor("Color Weekly Low", colorGreen) ;
Clrhigherperiodclose = ParamColor("Color Weekly Close", colorBlack) ;
Hw = TimeFrameGetPrice("H", inWeekly, 0,expandLast) ;
Lw = TimeFrameGetPrice("L", inWeekly, 0,expandLast) ;
Cw = TimeFrameGetPrice("C", inWeekly, 0,expandLast) ;
if (NOT showextensiononly)
{
Plot(Hw, "", Clrhigherperiodhigh , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
Plot(Lw, "", Clrhigherperiodlow , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
//Plot(Cw, "", Clrhigherperiodclose , styleThick|styleNoRescale|styleNoLabel)
}
Hwlast = SelectedValue(Hw) ;
Lwlast = SelectedValue(Lw) ;
//Cwlast = SelectedValue(Cw) ;
Hplot = LineArray(x0, Hwlast, x1, Hwlast) ;
Plot(Hplot, "", Clrhigherperiodhigh , styleLine|styleDots|styleNoRescale, 0,0,extend) ;
LPlot = LineArray(x0, Lwlast, x1, Lwlast) ;
Plot(LPlot, "", Clrhigherperiodlow , styleLine|styleDots|styleNoRescale, 0,0,extend) ;
//CPlot = LineArray(x0, Cwlast, x1, Cwlast) ;
//Plot(CPlot, "", Clrhigherperiodclose , styleLine|styleNoRescale, 0,0,extend) ;
}
if (showrollweek)
{
Clrrollperiodhigh = ParamColor("Color Rolling 5Day High", colorPink) ;
Clrrollperiodlow = ParamColor("Color Rolling 5Day Low", colorPaleGreen) ;
Clrrollperiodclose = ParamColor("Color Rolling 5Day Close", colorBlack) ;
weektradingdays = 5 ;
TimeFrameSet(inDaily);
Hrw = HHV(H, weektradingdays) ;
//Crw = HHV(C, weektradingdays) ;
Lrw = LLV(L, weektradingdays) ;
Hrwe = TimeFrameExpand(Hrw, inDaily, expandLast) ;
//Crwe = TimeFrameExpand(Crw, inDaily, expandLast) ;
Lrwe = TimeFrameExpand(Lrw, inDaily, expandLast) ;
TimeFrameRestore() ;
if (NOT showextensiononly)
{
Plot(Hrwe, "", Clrrollperiodhigh , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
Plot(Lrwe, "", Clrrollperiodlow , styleThick|styleDots|styleStaircase|styleNoRescale|styleNoLabel) ;
//Plot(Cw, "", Clrrollperiodclose , styleThick|styleNoRescale|styleNoLabel)
}
Hwlast = SelectedValue(Hrwe) ;
Lwlast = SelectedValue(Lrwe) ;
//Cwlast = SelectedValue(Crwe) ;
Hplot = LineArray(x0, Hwlast, x1, Hwlast) ;
Plot(Hplot, "", Clrrollperiodhigh , styleLine|styleDots|styleNoRescale, 0,0,extend) ;
LPlot = LineArray(x0, Lwlast, x1, Lwlast) ;
Plot(LPlot, "", Clrrollperiodlow, styleLine|styleDots|styleNoRescale, 0,0,extend) ;
//CPlot = LineArray(x0, Cwlast, x1, Cwlast) ;
//Plot(CPlot, "", Clrrollperiodclose , styleLine|styleNoRescale, 0,0,extend) ;
}
_SECTION_END();