24/8/18

RWI with Bull vs Bear Warning for Amibroker (AFL)

The random walk index (RWI) is a technical indicator that attempts to determine if a stock’s price movement is random or nature or a result of a statistically significant trend. The random walk index attempts to determine when the market is in a strong uptrend or downtrend by measuring price ranges over N and how it differs from what would be expected by a random walk (randomly going up or down).
The greater the range suggests a stronger trend. The RWI states that the shortest distance between two points is a straight line and the further prices stray from a straight line, implies the market is choppy and random in nature.


_SECTION_BEGIN("RWIHI");
minperiods = Param( "Min Periods", 9, 1, 200, 1 );
maxperiods = Param( "Max Periods", 40, 1, 200, 1 );
Plot( RWIHi( minperiods, maxperiods)  , _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("RWILO");
minperiods = Param( "Min Periods", 9, 1, 200, 1 );
maxperiods = Param( "Max Periods", 40, 1, 200, 1 );
Plot( RWILo( minperiods, maxperiods)  , _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
_SECTION_BEGIN("Line");
Line = Param( "Line", 1 );
Plot( Line, "Line", colorRed, styleThick | styleDashed | styleNoLabel );
_SECTION_END();
_SECTION_BEGIN("RWI System");
Sell = Cross( Line, RWIHi( minperiods, maxperiods));
Buy = Cross( RWILo( minperiods, maxperiods), Line);
for( i = 0; i < BarCount; i++ )
{
    if( Buy[i] ) PlotText( "Bull vs Bear" , i, 1,colorLavender);
    if( Sell[i] ) PlotText( "Bull vs Bear" , i, 1, colorLavender);
}
_SECTION_END();

0 Nhận xét :

Đăng nhận xét