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

[amibroker] Re: RSI - calculating an exit



PureBytes Links

Trading Reference Links

I found this as well via a friend from Tomasz himself:

////////////////////////////////
// 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 );

--- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@xxx> wrote:
>
> Oh BTW ( this is getting to be a habit  8 - )...you don't really
need to run 
> it throught the explorer every time - for my own convenience I have
removed 
> all the AddColumn's and just added Needed Array ( P1/Mult ) to the
Title of 
> my charts.
> 
> Steve
> 
> ----- Original Message ----- 
> From: "Steve Dugas" <sjdugas@xxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Tuesday, June 10, 2008 2:27 PM
> Subject: Re: [amibroker] Re: RSI - calculating an exit
> 
> 
> >I would probably try something like this....
> >
> > Calc = RSI( 14 );   // i.e., whatever formula you are using to
define your
> > RSI
> > Goal = 30;  // i.e., the RSI value where you want to set your stop
> >
> > Steve
> >
> > ----- Original Message ----- 
> > From: "droskill" <droskill@xxx>
> > To: <amibroker@xxxxxxxxxxxxxxx>
> > Sent: Tuesday, June 10, 2008 2:08 PM
> > Subject: [amibroker] Re: RSI - calculating an exit
> >
> >
> >> Great stuff - just a clarification - so if I'm doing an RSI
> >> calculation, I would put in the formula for RSI (100-100/RS+1 or
> >> something like that), and NOT use RSI (the default indicator)?
> >>
> >> --- In amibroker@xxxxxxxxxxxxxxx, "Steve Dugas" <sjdugas@> wrote:
> >>>
> >>> That sounds like a job for Fred's "Price Predictor" code ( thanks
> >> Fred! ). I
> >>> have attached it below, you will probably just need to plug your own
> >> values
> >>> into the Calc and Goal statements.
> >>>
> >>> Steve
> >>> _________________________________
> >>>
> >>> You supply:
> >>>
> >>> - The array in the first statement ( Assumedly Price )
> >>> - The Indicator in the Calc = statement
> >>> - The Goal in the Goal = statement
> >>>
> >>> ... It will return in Explore the value needed in the array in the
> >>> next bar to have the indicator meet the goal in the next bar.
> >>>
> >>> This is set up for use with a typical MACD but can be easily
modified
> >>> for use with any indicator you can design.
> >>>
> >>> P0   = Close;
> >>>
> >>> Acc  = 0.00001;
> >>>
> >>> LVBI = LastValue(BarIndex());
> >>> Mult = 1;
> >>>
> >>> for (i = 0; i < 10; i++)
> >>> {
> >>>     If (P0[LVBI] >= 1)
> >>>         i = 99;
> >>>     else
> >>>     {
> >>>         P0 = P0 * 10;
> >>>         Mult = Mult * 10;
> >>>     }
> >>> }
> >>>
> >>> P1   = Ref(P0, 1);
> >>> UpDn = 100 * P1[LVBI];
> >>>
> >>> for (i = 0; i < 200; i++)
> >>> {
> >>>     Calc = EMA(P1,12)-EMA(P1,26);
> >>>     Goal = EMA(EMA(P1,12)-EMA(P1,26),9);
> >>>
> >>>     if (Calc[LVBI] < Goal[LVBI])
> >>>         P1[LVBI] = P1[LVBI] + UpDn;
> >>>     else
> >>>         P1[LVBI] = P1[LVBI] - UpDn;
> >>>     UpDn = UpDn / 2;
> >>>     if (UpDn <= Acc)
> >>>     {
> >>>         j = i;
> >>>         i = 99999;
> >>>     }
> >>> }
> >>>
> >>> Accuracy = 100 * (abs(Goal[LVBI] - Calc[LVBI]) / Goal[LVBI]);
> >>>
> >>> Filter = BarIndex() == LVBI;
> >>>
> >>> AddColumn(Mult,                  "Multiplier",    1.0);
> >>> AddColumn(Calc[LVBI - 1] / Mult, "Curr Ind Val",  1.9);
> >>> AddColumn(Goal / Mult,           "Goal Ind Val",  1.9);
> >>> AddColumn(Calc / Mult,           "Calc Ind Val",  1.9);
> >>> AddColumn(j,                     "Iterations",    1.0);
> >>> AddColumn(Accuracy,              "Accuray (%)",   1.9);
> >>> AddColumn(Ref(P1, -1) / Mult,    "Current Array", 1.9);
> >>> AddColumn(P1 / Mult,             "Needed Array",  1.9);
> >>>
> >>>
> >>> ----- Original Message ----- 
> >>> From: "droskill" <droskill@>
> >>> To: <amibroker@xxxxxxxxxxxxxxx>
> >>> Sent: Tuesday, June 10, 2008 1:22 PM
> >>> Subject: [amibroker] RSI - calculating an exit
> >>>
> >>>
> >>> > Let's say that I've got a defined RSI level for an exit - and
I'd like
> >>> > to calculate a target based on that so I can have a stop order
in the
> >>> > market at a specific target.  Is there anyway for me to
calculate what
> >>> > the price would be on a given RSI level?
> >>> >
> >>> > Thanks!
> >>> >
> >>> >
> >>> > ------------------------------------
> >>> >
> >>> > 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
> >>> >
> >>> >
> >>> >
> >>> >
> >>>
> >>
> >>
> >>
> >> ------------------------------------
> >>
> >> 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
> >>
> >>
> >>
> >>
> >
> >
> >
> > ------------------------------------
> >
> > 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
> >
> >
> >
> >
>



------------------------------------

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/