How to filter a 5 minute trend using 15minute trend?

#1
Hi subroto and other experts

I like to watch a 5 minute chart with trend of 5 minutes and 15 minutes on it.
now how to filter a 5 minute trend using 15minute trend and on chart show clearly the trending area and non synch area?
trade when 5 min trend is in harmony with 15minute trend is the concept. but showing it on chart clearly is a problem i face.
trend is ma(c,10) as I define it.
PLEASE CHECK THIS CODE if ok or need corrections
-----------------------------------------------------------------
//15min ma10 on 5min or 5min chart
MA10=MA(C,10);//MA10 ON CURRENT TIMEFRAME OF 5 MINUTE CHART

TimeFrameSet( in15Minute) ;
MA10_15 =MA(C,10);
TimeFrameRestore( );
TimeFrameSet( 2*in15Minute) ;
MA10_30 =MA(C,10);
TimeFrameRestore( );

MA1015EXP =TimeFrameExpand(MA10_15, in15Minute);
MA1030EXP =TimeFrameExpand(MA10_30, 2*in15Minute);

Plot(TimeFrameExpand(MA10_15, in15Minute) ,"MA10 on 15min", colorRed) ;
Plot(TimeFrameExpand(MA10_30, 2*in15Minute) ,"MA10 on 30min", colorBlack) ;


Plot(MA10,"MA10",colorBlue,styleThick) ;
//Plot(3*MA10,"3*MA10",colorCustom12,styleThick) ;




uptrend=MA10>MA1015EXP AND MA10>MA1030EXP;
downtrend=MA10<MA1015EXP AND MA10<MA1030EXP;
Plot( 1.5, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
-------------------------------------------------------
thanks
regards
 
Last edited:
#2
Good concept.

We tested a method which trades 5 min pivots in the direction of 15 min pivots. So the trend was decided on 15 min pivots.It was tested on Nifty Futures as a daytrade method.

In the month of Feb 2013 the numbers are as under :

1) Total No of Trades .....41

2) Winers .....................27

3) Loosers ................... 14

4) Profits made in winning trades .......369 points

5) Points lost in loosers .....................77 points

6) Net profit/loss 369-77 = 292 points

7) Net profits after brokerage = 210 points ( considered 2 points round trip brokerage and taxes

8) Profit factor 4.79 :1

9) Average winning trade : 13.66 points

10) Average loosing trade : 5.5 points

Just thought of sharing as the concept and timeframes are identical to that of yours. Only thing is your trend defination is different.

Smart_trade
 
Last edited:

johnnypareek

Well-Known Member
#3
Hi subroto and other experts

I like to watch a 5 minute chart with trend of 5 minutes and 15 minutes on it.
now how to filter a 5 minute trend using 15minute trend and on chart show clearly the trending area and non synch area?
trade when 5 min trend is in harmony with 15minute trend is the concept. but showing it on chart clearly is a problem i face.
trend is ma(c,10) as I define it.
PLEASE CHECK THIS CODE if ok or need corrections
-----------------------------------------------------------------
//15min ma10 on 5min or 5min chart
MA10=MA(C,10);//MA10 ON CURRENT TIMEFRAME OF 5 MINUTE CHART

TimeFrameSet( in15Minute) ;
MA10_15 =MA(C,10);
TimeFrameRestore( );
TimeFrameSet( 2*in15Minute) ;
MA10_30 =MA(C,10);
TimeFrameRestore( );

MA1015EXP =TimeFrameExpand(MA10_15, in15Minute);
MA1030EXP =TimeFrameExpand(MA10_30, 2*in15Minute);

Plot(TimeFrameExpand(MA10_15, in15Minute) ,"MA10 on 15min", colorRed) ;
Plot(TimeFrameExpand(MA10_30, 2*in15Minute) ,"MA10 on 30min", colorBlack) ;


Plot(MA10,"MA10",colorBlue,styleThick) ;
//Plot(3*MA10,"3*MA10",colorCustom12,styleThick) ;




uptrend=MA10>MA1015EXP AND MA10>MA1030EXP;
downtrend=MA10<MA1015EXP AND MA10<MA1030EXP;
Plot( 1.5, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
-------------------------------------------------------
thanks
regards
Hi,

Your coding is ok, but I think you missed one part in your condition that is 15min ma should be above 30ma. If this is done then check the ribbon color of above chart with your afl n below is mine as per aboce.
HTML:
//15min ma10 on 5min or 5min chart
MA10=MA(C,10);//MA10 ON CURRENT TIMEFRAME OF 5 MINUTE CHART

TimeFrameSet( in15Minute) ;
MA10_15 =MA(C,10);
TimeFrameRestore( );
TimeFrameSet( 2*in15Minute) ;
MA10_30 =MA(C,10);
TimeFrameRestore( );

MA1015EXP =TimeFrameExpand(MA10_15, in15Minute);
MA1030EXP =TimeFrameExpand(MA10_30, 2*in15Minute);

Plot(TimeFrameExpand(MA10_15, in15Minute) ,"MA10 on 15min", colorRed) ;
Plot(TimeFrameExpand(MA10_30, 2*in15Minute) ,"MA10 on 30min", colorBlack) ;


Plot(MA10,"MA10",colorBlue,styleThick) ;
//Plot(3*MA10,"3*MA10",colorCustom12,styleThick) ;




uptrend=MA10>MA1015EXP AND MA10>MA1030EXP AND MA1015EXP>MA1030EXP;
downtrend=MA10<MA1015EXP AND MA10<MA1030EXP AND MA1015EXP<MA1030EXP;
Plot( 1.5, /* defines the height of the ribbon in percent of pane width */"ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.15, 100 );
 
Last edited:
#6
Hi friends
thanks for your ideas.
I wish to have a code of pivot on 5min chart and pivot of 15min plotted on 5min chart.then I can try to see how trade with 5 min pivot in the direction of 15min pivot looks like

can you post the code afl please!

thanks once again and regards
ford
 

johnnypareek

Well-Known Member
#7
15 minute pivot on 5 min

HTML:
_SECTION_BEGIN("Price");

GraphXSpace=5;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
up=4969;
dn=4952;
//Plot(up,"UP Break",5,8);
//Plot(dn,"DN Break",4,8);


_SECTION_END();



H1=SelectedValue( TimeFrameGetPrice( "H", in15Minute, -1 ));
L1=SelectedValue(TimeFrameGetPrice( "L", in15Minute, -1 ));
C1=SelectedValue(TimeFrameGetPrice( "C", in15Minute, -1 ));
/*PIVOT Calculation*/
p = ( H1+ L1 + C1 )/3;
s1 = (2*p)-H1;
r1 = (2*p)-L1;
s2 = p -(H1 - L1);
s3 = S1 - (H1-L1);
r2 = p +(H1 - L1);
r3 = R1 +(H1-L1);

Plot (p,"Pivot",25,styleDots);
Plot (r1,"R1",12,1);
Plot (r2,"R2",12,1);
Plot (r3,"R3",12,1);
Plot (s1,"S1",3,1);
Plot (s2,"S1",3,1);
Plot (s3,"S1",3,1);
X=Cross(C,p);
Z=Cross(p,C);
PlotShapes(IIf(X,shapeUpTriangle,shapeNone),colorAqua,0,Low,Offset=-20);
PlotShapes(IIf(Z,shapeDownTriangle,shapeNone),colorPink,0,High,Offset=-20);

_SECTION_END();
 

sr114

Well-Known Member
#8
Hi friends
thanks for your ideas.
I wish to have a code of pivot on 5min chart and pivot of 15min plotted on 5min chart.then I can try to see how trade with 5 min pivot in the direction of 15min pivot looks like

can you post the code afl please!

thanks once again and regards
ford
the best pivot charts afl having base time frame (any tf ) and the pivot in multiple tf (tf multiple 5/10/15/30/60) or any time frame u choose is written by Ed Pottasch called autotrendline in multiple time frame in 2012 and u will get it in amibroker library or search online

if u r unable to find it, pls specify , then i can post the code

rgds
subroto
 

sr114

Well-Known Member
#9
15 minute pivot on 5 min

HTML:
_SECTION_BEGIN("Price");

GraphXSpace=5;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
up=4969;
dn=4952;
//Plot(up,"UP Break",5,8);
//Plot(dn,"DN Break",4,8);


_SECTION_END();



H1=SelectedValue( TimeFrameGetPrice( "H", in15Minute, -1 ));
L1=SelectedValue(TimeFrameGetPrice( "L", in15Minute, -1 ));
C1=SelectedValue(TimeFrameGetPrice( "C", in15Minute, -1 ));
/*PIVOT Calculation*/
p = ( H1+ L1 + C1 )/3;
s1 = (2*p)-H1;
r1 = (2*p)-L1;
s2 = p -(H1 - L1);
s3 = S1 - (H1-L1);
r2 = p +(H1 - L1);
r3 = R1 +(H1-L1);

Plot (p,"Pivot",25,styleDots);
Plot (r1,"R1",12,1);
Plot (r2,"R2",12,1);
Plot (r3,"R3",12,1);
Plot (s1,"S1",3,1);
Plot (s2,"S1",3,1);
Plot (s3,"S1",3,1);
X=Cross(C,p);
Z=Cross(p,C);
PlotShapes(IIf(X,shapeUpTriangle,shapeNone),colorAqua,0,Low,Offset=-20);
PlotShapes(IIf(Z,shapeDownTriangle,shapeNone),colorPink,0,High,Offset=-20);

_SECTION_END();
Jhonybhai

thnx for the code but i think that he is searching for the swing hi lo /pivot points in higher time frame overlaid in a base lower time frame - eg in 5 min tf he is searching for the 15/30/60 min swing points/pivots points

rgds
subroto
 
#10
Hi subroto & Johnny

sorry for the trouble.
I could not express what i wanted clearly.
----------------------------------------------------------------
my point was taken from smart trade comments-he said
We tested a method which trades 5 min pivots in the direction of 15 min pivots. So the trend was decided on 15 min pivots.It was tested on Nifty Futures as a daytrade method.
-----------------------------------------------------------
In view of above valuable comment,I thought if I can get a code where I can have on a 5 minute chart,both 5minute pivot main(pp) and 15min pivot main, so that I can see THE DIRECTION OF 15MIN PIVOT trend and trade along that but in harmony with 5min pivot trend.
Thanks to johnny for his code.I took it and tailored to my need.
Somehow,instead of two curved lines i got two horizontal lines,which made me think if I made a mistake.
I am still having the moving average trendlines of 15min,30min in mind and expecting pivot lines may follow similar pattern.
Is there a need to use timeframeset and timeframerestore things which may be missed?
I request smart trade to comment if i am on right track in following his method
the code i have (courtesy johnny) is as below.if anything not ok,please correct. best regards
----------------------------------------------
HTML:
   _SECTION_BEGIN("Price");

GraphXSpace=5;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
up=4969;
dn=4952;


_SECTION_END();
//==============================================
H2=SelectedValue( TimeFrameGetPrice( "H", 2*in15Minute, -1 ));
L2=SelectedValue(TimeFrameGetPrice( "L", 2*in15Minute, -1 ));
C2=SelectedValue(TimeFrameGetPrice( "C", 2*in15Minute, -1 ));
/*PIVOT Calculation*/
p30 = ( H2+ L2 + C2 )/3;

Plot (p30,"Pivot30MIN",colorCustom12,styleDots);


//=================================
H1=SelectedValue( TimeFrameGetPrice( "H", in15Minute, -1 ));
L1=SelectedValue(TimeFrameGetPrice( "L", in15Minute, -1 ));
C1=SelectedValue(TimeFrameGetPrice( "C", in15Minute, -1 ));
/*PIVOT Calculation*/
p15 = ( H1+ L1 + C1 )/3;

Plot (p15,"Pivot15MIN",colorBlue,styleDots);
X=Cross(C,p15);
Z=Cross(p15,C);
PlotShapes(IIf(X,shapeUpTriangle,shapeNone),colorAqua,0,Low,Offset=-20);
PlotShapes(IIf(Z,shapeDownTriangle,shapeNone),colorPink,0,High,Offset=-20);

_SECTION_END();
 

Similar threads