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

[amibroker] Help needed - buystop



PureBytes Links

Trading Reference Links

Hello,

i have started to build a system through copy and paste.
Works fine now, however i would like to have a buystop included.
Can someone please tell me how to do that ?
I would also like to have a line displayed for the buystop.
Would be very happy to get some help !

Regards

Klaus

ATRamount = 3*ATR(14);
stop_amount =
0.0050;
LongSetup =
Cross(EMA(C,3),EMA(C,13));
Buy=LongSetup;
trail =
0;trailstop =0; defstop = 0;
for( i = 1; i < BarCount; i++ )
{
if( trailstop == 0 AND Buy[ i-1 ] )

trailstop =
Max(stoploss,High[ i ] - ATRamount[ i ]);
priceatbuy =
BuyPrice[ i ];
stoploss =
BuyPrice[i] - stop_amount;

if( trailstop > 0 AND Low[ i ] < trailstop )
{
Sell[ i ] = 4;
SellPrice[ i ] = trailstop;
trailstop=
0;
}

else Sell[ i ] = 0;

if( trailstop > 0 )
{
trailstop =
Max( High[ i ] - ATRamount[ i ], trailstop );
}
trail[ i ] = trailstop;
}
Buy = ExRem(Buy,Sell);

PointValue = 10000; PositionSize = MarginDeposit = 1;
inLong =
Ref(Flip(Buy,Sell),-1);
inNothing = inLong==
0 ;
Equity(1,0);
Plot(C,"",1,styleBar);
PlotShapes(shapeCircle*(Sell==4),colorRed,0,SellPrice,0);
PlotShapes(shapeCircle*Buy,colorBlue,0,BuyPrice,0);
PlotShapes(shapeSmallCircle*(Longsetup AND NOT inlong),colorBlue,0,Close,0);
Plot(IIf(trail!=0,trail,
IIf(Sell AND Ref(inlong,-1),Ref(trail,-1),Null)),"trailing stop level",colorRed,styleDots);



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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS