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

Re: [amibroker] Coding a breakout system



PureBytes Links

Trading Reference Links

Al,

I believe it has something to do with these items:

UpBreak=HHV(H,HH);
BuyCond=Cross(H,UpBreak);

change to this: Buycond=Cross(H, ref(UpBreak,-1);

and this:

DnBreak=LLV(L,LL);
SellCond=Cross(DnBreak,L);

change to: Sellcond=Cross(ref(DnBreak,-1),L);

After I made these changes to your formula , it backtested.

Anthony

Al Venosa wrote:

> Hi, All:
>
> Crack programmer I am not. I am trying to code a simple breakout
> system, but when I try to invoke it in AA, I get no trades at all.
> Obviously, something's wrong, but I can't figure it out. The code I
> wrote is given below. I want to buy when the high exceeds the
> highest high over the last HH periods and then sell (exit) when the
> low declines below the lowest low over the last LL periods. I also
> want to set a hard stop at 2*ATR(15) below my entryprice, which
> should remain fixed throughout the trade. Can someone look over the
> code below and tell me what is wrong? I'd really appreciate it. It's
> probably something very simple and stupid.
>
> HH=Optimize("HH",20,20,60,4);
> LL=Optimize("LL",10,10,40,4);
> pds=15;
> UpBreak=HHV(H,HH);
> BuyCond=Cross(H,UpBreak);
> Buy=Ref(BuyCond,-1);
> BuyPrice=Open;
> FixedBuyPrice=ValueWhen(Buy,Open);
> Capital = 100000;
> Risk=0.01*Capital;
> PositionSize=Risk/(2*ATR(pds))*FixedBuyPrice;
> DnBreak=LLV(L,LL);
> ApplyStop(0,2,2*ATR(pds),1);
> SellCond=Cross(DnBreak,L);
> Sell=Ref(SellCond,-1);
> SellPrice=Open;
> Short=0;Cover=0;
> Buy=ExRem(Buy,Sell);
> Sell=ExRem(Sell,Buy);
>
> Thanks a lot, folks.
>
> Al V.
>
>
> Yahoo! Groups Sponsor
ADVERTISEMENT


>
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.