Reverse engineer RSI posted earlier:

 

_SECTION_BEGIN("RSI_Next_Bar");

////////////////////////////////

// Reverse Engineer RSI

////////////////////////////////

Value_Exit_Long = Param("RSI ExitLong", 70, 1, 100, 0.1 );

Value_Exit_Short = Param("RSI ExitShort", 30, 1, 100, 0.1 );

 

WildPer = Param("Time periods", 2, 1, 100 );

ExpPer = 2 * WildPer - 1;

AUC = EMA( Max( C - Ref( C, -1 ), 0 ), ExpPer );

ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer );

long_x = (WildPer - 1) * ( ADC * Value_Exit_Long / (100-Value_Exit_Long) -
AUC);

long_RevEngRSI = IIf( long_x >= 0, C + long_x, C + long_x *
(100-Value_Exit_Long)/Value_Exit_Long );

 

short_x = (WildPer - 1) * ( ADC * Value_Exit_short / (100-Value_Exit_short)
- AUC);

short_RevEngRSI = IIf( short_x >= 0, C + short_x, C + short_x *
(100-Value_Exit_short)/Value_Exit_short );

 

Plot( Close, Date()+", Close ", colorBlack, styleCandle );

Plot( long_RevEngRSI,"LongRevEng. RSI( "+WriteVal(WildPer,1.0)+",
"+WriteVal(Value_exit_long, 1.2)+" )",colorGreen );

Plot( short_RevEngRSI,"ShortRevEng. RSI( "+WriteVal(WildPer,1.0)+",
"+WriteVal(Value_exit_short, 1.2)+" )",colorRed );

_SECTION_END();

 

 

Reply via email to