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

[amibroker] Graham Please Help ?.. how would write buy and sell statement for this formula



PureBytes Links

Trading Reference Links

Graham ….. how would write buy and sell statement  for this Formula 
… to be used in AA, scan!

I got this pretty nice Formula, Where I spent lots of time trying to 
figure the right buy & sell statement to go with it in order to test 
in AA , with no success…

Please Help,

The formula :

// RSI divergence
// Backgraund color White


P = Param("Priod RSI", 14, 9, 14, 1);
VRSI = RSI(P);

Length = 100; 
Lapse = 3; 

fUp = VRSI > Ref(VRSI, -1) & VRSI > Ref(VRSI, 1) & VRSI >55;
fDown = VRSI < Ref(VRSI, -1) & VRSI < Ref(VRSI, 1) & VRSI < 45;

Div = 0;

for(i = Length; i < BarCount; i++)
{

// Down
if(fUp[i])
{
k = i-1;
do
{
if(VRSI[k] > VRSI[i] & fUp[i] & fUp[k])
{
if(C[k] < C[i] & i-k > Lapse)
{
Div[i] = 1;
}
k = i-Length;
}
else
k = k-1;
} while( k > i-Length );
}

////////////////////////////

// Up

if(fDown[i])
{
k = i-1;
do
{
if(VRSI[k] < VRSI[i] & fDown[i] & fDown[k])
{
if(C[k] > C[i] & i-k > Lapse)
{
Div[i] = -1;
}
k = i-Length;
}
else
k = k-1;
} while( k > i-Length );
}

}



Fon = IIf(Div == 0, 0, 1);

Col = IIf(Div == 1, 4, IIf(Div == -1, 5, 1));

Color = IIf(Div == 1, 48, IIf(Div == -1, 14, 1));

Color = IIf(fUp == 1, 48, IIf(fDown == 1, 14, 1));

Div = IIf(Div == 0, Null, abs(Div));
Fon = abs(Div);




Title = EncodeColor(4)+"RSI(" + WriteVal(P, 2.0) + ")" + EncodeColor
(1) + " ="+WriteVal(RSI(P)); 
Plot( RSI(P), "RSI", Col, 1);
Plot( 25,"", 4, 16+4096);
Plot( 75,"", 4, 16+4096);
Plot(Fon, "", Color, 16384+32768+4096, MinValue = 0, MaxValue = 1);

Plot( 30, "", colorGreen, ParamStyle("30 LINE STYLE"));
Plot( 70, "", colorRed, ParamStyle("70 LINE STYLE"));
Plot( 50, "", colorYellow, ParamStyle("50 LINE STYLE"));









------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

<*> 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/