flowridej

Below was posted previously by Fred Tonetti.

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

From: Fred <[EMAIL PROTECTED]>

Subject: Generalized Price Required to Meet am Indicator Goal

I had posted this along time ago ... 

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   = C;

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;
    }   
> [quoted text muted]
} 

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;
    }
> [quoted text muted]
}

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




--- In [email protected], "flowridej" <[EMAIL PROTECTED]> 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;
> > }
>


Reply via email to