Hi Mithil,

I think understand why you want to use this: you want to know which value the 
close has to reach for the RSI to reach a certain level, for example overbought 
at 70 and then you would close the position at market on close. 
Please see the formula below which allows 2 parameters: an overbought RSI level 
and an oversold value (I just copied your formula and added the second value).
But I have a question: the RSI reverse engineered value given is for today. 
Which is of no use as the market is closed already! So, based on today's close, 
we would need engineered value for tomorrow. I think it is very simple to 
change in the code but I have to admit I don't know how to do this...perhaps 
anyone would like to help here.

Here is the code again (with 2 parameters instead of one):

_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", 14, 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();


Thanks,
Carl

--- In amibroker@yahoogroups.com, "infynhome" <infynh...@...> wrote:
>
> Hi,
> 
> Below is one formula for Reverse Engineering RSI which I have picked up from 
> this group.
> Now, the formula currently resolves value of 39.82 for the RSI and plots on 
> the chart. In the same manner, I need other values of RSI namely 50 and 65 to 
> be plotted on the same chart.
> 
> I tried changing the values, but it is not working.
> 
> Somebody please help.
> 
> ////////////////////////////////
> // Reverse Engineer RSI
> ////////////////////////////////
> Value = Param("RSI value", 39.82, 1, 100, 0.1 );
> WildPer = Param("Time periods", 14, 1, 100 );
> ExpPer = 2 * WildPer - 1;
> AUC = EMA( Max( C - Ref( C, -1 ), 0 ), ExpPer );
> ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer );
> x = (WildPer - 1) * ( ADC * Value / (100-Value) - AUC);
> RevEngRSI = IIf( x >= 0, C + x, C + x * (100-Value)/Value );
> Plot( Close, Date()+", Close ", colorBlack, styleCandle );
> Plot( RevEngRSI,
>       "Reverse Eng. RSI( "+WriteVal(WildPer,1.0)+", "+
>       WriteVal(Value, 1.2)+" )",
>       colorGreen );
> 
> Rgds
> Mithil
>


Reply via email to