re: Day trading Nifty & Banknifty Futures
Can u pls give me the code for
the band posted in post # 20774 .
I tried to go through Pratap Sir's thread,
it will need a detailed study, which I am
going to do over the weekend. Meanwhile
if u can provide the code it will be helpful.
Below is the afl of pratap sir...
PLEASE GO THROUGH HIS THREAD FOR THE FULL USE OF HIS METHOD
_SECTION_BEGIN("SRSARTFtj3min");
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", colorPaleGreen);
Clrdown = ParamColor( "Color Down", colorPaleGreen);
Clrsw = ParamColor( "Color SW", colorPaleGreen);
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();