Combining Trend-VWAP-Ranges - Pratap's method

Vipul_84

Well-Known Member
#52
Position sizing is explained by Pratap sir at other post. This is the summary:

1.5% risk per trade, 20 pts SL and 1L per 1 Lot. Generally trying to make 200 pts in a month so that its almost 15% return per month.

Now we need to focus of entry exit rules:

1. No short above upper Band
2. No long below lower band

Now, let Pratap sir come come add TWO important rules to this:

Exact Entry & Exit.

Then we can backtest for some period.
 
#53
code below price with high vol highligted with dot

there are various things that can be done depending on how the parameters are selected
1. different scipt in other pane
2. different tf in other pane
3. coloring the bar as per yday close
4. scaling the pane so that there is some free area above and below chart

checkout the parameters

Code:
_SECTION_BEGIN("HighVol");
SetChartOptions(0,chartShowArrows|chartShowDates|chartWrapTitle);
SetChartBkColor(ParamColor("Background", colorLightGrey)) ;

useforeign = ParamToggle("Set Foreign", "No|Yes", 0) ;
//List = GetCategorySymbols(categoryMarket, 0) ;
//forscript = ParamList("Scrip", List, 0) ;
forscript = ParamStr("Foreign Script", "BANKNIFTY-I") ;
if (useforeign)
	SetForeign(forscript); 

settf = ParamToggle("Set TF", "No|Yes", 0) ;
tf = Param("TF", 5, 1, 100000, 1) ;

if (settf)
{
	SetChartOptions(3,chartShowDates);
	TimeFrameSet(tf*in1Minute) ;
}

Layer = Param("Layer", 0, -5, 5, 1) ;
if (settf)
	tz = NumToStr(tf, 8.0) +"-minute";
else
	tz = NumToStr(Interval()/in1Minute, 8.0) +"-minute";

strname =  Name();
if (useforeign)
	strname = forscript ;

//_N(Title = StrFormat(Name() + " " +tz + " " + NumToStr(ddt, formatDateTime) + " Range %g {{VALUES}}", SelectedValue( dh-dl) ));
_N(Title = StrFormat(strname+tz+ NumToStr(DateTime(), formatDateTime)+ 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 ) ) ));

showprice = ParamToggle("Show Price", "No|Yes", 1) ;
styleprice = IIf(showprice, 0, styleNoDraw) ;
//if (showprice)
	Plot( C, "Close",  colorBlack, styleNoTitle | styleCandle|styleprice,0,0,0,Layer ); 
ToolTip = "Open = " + O + "\nHigh = " + H + "\nLow = " + L + "\nClose = " + C ;

if (settf)
{
Daych = Day() != Ref(Day(), -1) ;
Plot(IIf(Daych, 100, 0), "", colorBlack, styleHistogram|styleNoLabel|styleOwnScale, 0, 100, 0, -5) ;
}
//Peaking Volumes
HiVolume = IIf(V > (2 * MA(V,10)), True, False); 
PlotShapes(shapeSmallCircle * HiVolume, IIf(C > O, colorBlack, colorWhite), 0, (O+C)/2, 0);
//TimeFrameRestore()

Clronclose = ParamToggle("Color on yday close", "No|Yes", 0) ;
if (Clronclose)
{
	ydayc = TimeFrameGetPrice("C", inDaily,0, expandLast) ;

	Clr = IIf(C > ydayc, colorBlue, IIf(C < ydayc, colorRed, colorGrey40)) ;
	SetBarFillColor(Clr) ;
	Plot(C, "", Clr, styleCandle|styleNoLabel, 0, 0, 0, 1) ;
}

scalefromclose = ParamToggle("Scale from Close", "No|Yes", 1) ;
per = Param("Percentage",40,0,50,10);
Mingap = Param("Min Gap", 20, 1, 10000, 1) ;

if (scalefromclose)
{
	Lvh = Lvl = SelectedValue(C);
	Lvhh = HighestVisibleValue(H) ;
	Lvll = LowestVisibleValue(L) ;
	spl = sph = (Lvhh-Lvll)*per/100 ; // Param("pointsup",50,0,500,10);
	Plot( Max(Max(Lvh+sph, Lvhh+sph/2), Lvh+Mingap), "", colorBlack,styleNoDraw);
	Plot( Min(Min(Lvl-spl, Lvll-spl/2), Lvl-Mingap), "", colorBlack,styleNoDraw);
}


_SECTION_END();
e.g.

NF 3min and 5min

vertical lines in lower pane are day changes
as TF is different hozintal scale not there

one can select the bar and see time and details in title or on mouse move tip



nf 3min 15min



NF 3min 1st pane

bnf 5min 2nd pane :D


sir .. nice work .. thanks for sharing .. i have one idea about this..add some trend reversal candle for buy sell finding this s work well
 

pratapvb

Well-Known Member
#55
in my chart I have both 5min AMA (golden) and 15min AMA lavender......I trail on golden 5min ama and look to re-enter upto 15min AMA. if 5min AMA is not too far apart then I don't bother exiting on that and wait for 15min AMA below which will be SAR

as I already mentioned I take partial profit at 20pts and only trail rest. whether partial point is half or 1/3rd depends on whether you are in strong trend between +1SD2day / -1SD2day or between them
 

blackberry

Well-Known Member
#56
in my chart I have both 5min AMA (golden) and 15min AMA lavender......I trail on golden 5min ama and look to re-enter upto 15min AMA. if 5min AMA is not too far apart then I don't bother exiting on that and wait for 15min AMA below which will be SAR

as I already mentioned I take partial profit at 20pts and only trail rest. whether partial point is half or 1/3rd depends on whether you are in strong trend between +1SD2day / -1SD2day or between them
sir how ro use it on EOD chart,does it reqiure to change param TF settings.if yes what it would be.

Edit:
What is the significance of TF yes/no in param
 
Last edited:

pratapvb

Well-Known Member
#57
sir how ro use it on EOD chart,does it reqiure to change param TF settings.if yes what it would be.

Edit:
What is the significance of TF yes/no in param
usetf yes/no is whether to use the TF param to get for higher TF like daily on 15min chart or 15min on 5min chart etc

if using on daily chart then just put ..... default is to show for the chart tf that is usetf = NO

but if you want daily AMA on say 15min chart then put on 15min chart with
usetf = YES
TF = 1440
 

pratapvb

Well-Known Member
#58
weekly monthly and yearly have +1

that is weekly is actually 1440*5*60+1

this cannot be done with this AFL

1440*5 = 7200 if you put you will get something like 5 day chart (not necessarily weekly like mon-fri) which is a close approximation
 

blackberry

Well-Known Member
#59
usetf yes/no is whether to use the TF param to get for higher TF like daily on 15min chart or 15min on 5min chart etc

if using on daily chart then just put ..... default is to show for the chart tf that is usetf = NO

but if you want daily AMA on say 15min chart then put on 15min chart with
usetf = YES
TF = 1440


This is 3 minute TF with Param use TF= yes and TF 15
is it ok? Sir.

 

Similar threads