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

[amibroker] Re: ATR Trading System



PureBytes Links

Trading Reference Links

Played around with this some more - enjoy.

George

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

_SECTION_BEGIN("ATR Trading System");


/*Writed & composed by Tudor Marcelin - Art Invest*/

k=Param("Multiplier",1.5,0.1,200,0.1); /* multiplication factor*/
n=Param("Period",10,1,200,1);/*period*/
z=Param("Counter",11,1,100,1);/*loop counter*/
f=ATR(n);


R[0] = C[0];

S[0] = C[0];
for( i = z; i < BarCount; i++ )
{


R[i]=R[i-1];
S[i]=S[i-1];

if ( C[i-1] >R[i-1] )
{
r[i] = C[i-1]+k*f[i-1];
s[i]= C[i-1]-k*f[i-1];
}
if ( C[i-1] <S[i-1] )
{
r[i] = C[i-1]+k*f[i-1];
s[i]= C[i-1]-k*f[i-1];
}

barcolor = IIf(C[i] > R, colorGreen, colorRed);

}
Plot(Close,"Close",barcolor,styleBar);
Plot(R, "R:",colorGreen,styleDots|styleNoLine);
Plot(S, "S:",colorRed,styleDots|styleNoLine);

Buy=Close>R;
Sell=Close<S;

Cump=IIf(Close>R,1,0);
Vanz=IIf(Close<S,1,0);

Buy = ExRem( Buy, Sell ); //Elimina semnalele buy consecutive
Sell = ExRem( Sell, Buy ); //Elimina semnalele sell consecutive

shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

fig=Cump*shapeHollowUpArrow + Vanz*shapeHollowDownArrow;

PlotShapes( fig, IIf( Cump, colorPaleGreen , colorPink), 0, IIf(Cump,
Low-1, High+1)); 
//Pentru a vizualiza semnalele consecutive eliminate de ExRem
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy,
Low-1, High+1));

AlertIf( Buy, "", "Experiment", 1 );
AlertIf( Sell, "", "Experiment",2);

GraphXSpace = 3;

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %
g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue(
ROC( C, 1 ) ) ));

Title=EncodeColor(colorBlue)+"Experiment"+EncodeColor(colorBlack)
+ " Open:"+O+" High:"+H+" Low:"+L+" Close:"+C+EncodeColor(colorGreen)
+" R -->"+R+EncodeColor(colorRed)+" S-->"+S+EncodeColor(colorBlue)+
" \nDate: "+EncodeColor(colorRed)+Date();
_SECTION_END();



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/