[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: reverse RSI calculation



PureBytes Links

Trading Reference Links

Hi Jason,

  I found it while surfing the net... hope it will help u.
  Code for 'Reverse Engineer RSI' in AFL:

  _SECTION_BEGIN("Reverse Engineer RSI");
Value = Param("RSI value", 50, 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, styleBar );
Plot( RevEngRSI,"Reverse Eng. RSI( "+WriteVal(WildPer,1.0)
+", "+WriteVal(Value, 1.2)+" )",colorGreen );
_SECTION_END();


Cheers,
Soumya


--- In amibroker@xxxxxxxxxxxxxxx, "flowridej" <flowridej@xxx> wrote:
>
> Does anyone know how to calculate a closing price based on an RSI 
> value?  I am trying to figure out what the closing price has to be 
> tomorrow for the RSI value to be above 70.  I have tried working 
with 
> the formula but can't figure out how to modify it to accept the 
hard 
> coded RSI of 70 and give me tomorrows closing price.
> 
> Below is a verion of RSI from Tomasz in thread:
> http://finance.groups.yahoo.com/group/amibroker/messages/113398?
> threaded=1&m=e&var=1&tidx=1
> 
> Can anybody help me figure out how to modify this to give me the 
> close price (that would result in an RSI value over 70)?
> 
> thanks,
> Jason
> 
> 
> > function BuiltInRSIEquivalent( period )
> > {
> >  P = N = 0;
> >
> >  result = Null;
> >
> >  for( i = 1; i < BarCount; i++ )
> >  {
> >    diff = C[ i ] - C[ i - 1 ];
> >    W = S = 0;
> >    if( diff > 0 ) W = diff;
> >    if( diff < 0 ) S = -diff;
> >
> >    P = ( ( period -1 ) * P + W ) / period;
> >    N = ( ( period -1 ) * N + S ) / period;
> >
> >    if( i >= period )
> >       result[ i ] = 100 * P / ( P + N );
> >  }
> >  return result;
> > }
>




Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/