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

[amibroker] Re: Help on predicting next day price for RSI cross!



PureBytes Links

Trading Reference Links

idumall, this may be what you are looking for.
It was posted some time back by Fred Tonetti:

From: Fred <ftonetti-p32f3XyCuykqcZcGjlUOXw@xxxxxxxxxxxxxxxx>

Subject: Generalized Price Required to Meet am Indicator Goal

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

} 

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



--- In amibroker@xxxxxxxxxxxxxxx, "idumall" <idumall@xxx> wrote:
>
> Hi 
> 
> I'm trying to code the afl to find out the price next day should 
the 
> RSI crosses its own moving average. 
> 
> E.g., In order for RSI(5) to cross above MA(RSI(5),15), what will 
be 
> the price next day? 
> 
> Please help. 
> Thank you.
>




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/