Real Money Flow Index - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Real Money Flow Index - Amibroker AFL Code

_SECTION_BEGIN("money flow indicator");

// Money Flow Indicator - FVE by Markos Katsanos - almost identical to proprietary TSV money flow indicator by Worden

Period = Param("Period for FVE", 22, 5, 80, 1 );
Coeff = Param("Coeff for Cutoff", 0.1, 0, 2, 0.01 );

intra=log(H)-log(L);
Vintra = StDev(intra, period );
inter = log(Avg)-log(Ref(Avg,-1));
Vinter = StDev(inter,period);
Cutoff = Coeff * (Vinter+Vintra)*C;
MF = C- (H+L)/2 + Avg - Ref( Avg, -1 );
VC = IIf( MF > Cutoff, V,
IIf( MF < -Cutoff, -V, 0 ));
FVE = 100 * Sum( VC, Period )/(MA( V, Period ) * Period );

// Momemtum Indicator by William Blau

TSI = 100 * ( EMA( EMA( C - Ref( C, -1 ) ,25 ) ,13)
/ EMA( EMA( abs( C - Ref( C, -1) ),25 ), 13 ) );

// Plots for money flow and momentum indicators

Plot(TSI,"TSI",colorYellow,1); //Plots TSI line

PlotGrid(25,55); // shows white grid line for black background
PlotGrid(-25,-55); // same

Plot(EMA(TSI,5),"TSI signal",colorGreen,1); // Plots a 7 day EMA of TSI

Plot( FVE, "Modified FVE", colorWhite, styleThick ); // FVE line is shown in red
Plot (0,"",colorBlue,styleNoLabel); // shows a blue line through 0


RAD_TO_DEG = 180/3.1415926; // radians to degrees
LinRegAngleFVE = RAD_TO_DEG * atan( LinRegSlope( FVE, 22 ) ); // calculates angle of money flow indicator

// Buy Rules
/*
Buy = FVE > -10 AND FVE < 10 AND
LinRegAngleFVE > 30 AND
FVE > EMA( FVE, 5 ) AND EMA(FVE, 5) > EMA(FVE, 22) AND
LinRegSlope( C, 10 ) < Ref(C, -10 ) *0.6/100 AND
LinRegSlope( C, 10 ) > -Ref( C, -10 ) * 0.3/100 AND Cross( TSI, EMA(
TSI, 7 ) );
*/
Buy = tsi > EMA(tsi,5);
// Sell Rules

Sell = tsi < EMA(tsi,5);
/*
Sell = Cross (EMA (TSI, 7), TSI) OR LinRegAngleFVE < -20;
*/
PlotShapes(Buy*shapeUpArrow,colorGreen);
PlotShapes(Sell*shapeDownArrow,colorRed);


_SECTION_END();
SHARE
  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment