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

#31
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 );
How to you put Buy / Sell conditions in this AFL?
 

Similar threads