PureBytes Links
Trading Reference Links
|
To fix number of contracts to 1;
PositionSize=MarginDeposit;
To trade 2 contracts:
PositionSize=2*MarginDeposit;
Be sure to set the Margin (Symbol>Information>Margin Deposit) or in
AFL...
MarginDeposit=xxxx;
-CS
----- Original Message -----
<BLOCKQUOTE
>
<DIV
>From:
<A title=kk2628@xxxxxxxxxxxxxxxx
href="">kk2628
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, December 10, 2003 2:07
AM
Subject: [amibroker] Need help
Hi,
I just try to test out an article by Larry
Connors "Do You Buy Breakouts? Think Again" <A
href="">http://biz.yahoo.com/tm/031208/11017_4.html.
However, I have been struggle with the AFL code
to find out the total points as described in the article (I do not expect the
same figure but should be close enough). There are two ways I can do it (I
assume), one is the easier way using AA backtester but I faced the challenge
to fix the number of contract to 1. The number of contract get increase and
decrease along the way and I have played with the Positionsize but no success.
Another way is to accummulate the different between the sellprice and buyprice
and use Explorer to find out the net total points. But I failed to code in
both ways.
Following is the AFL I have tried but
failed. Greatly appreciate your help here to point out my error.<FONT
color=#000000 size=1>
newhigh=Cross<FONT color=#000000
size=1>(H,Ref<FONT
color=#000000 size=1>(HHV<FONT
color=#000000 size=1>(H,<FONT color=#ff00ff
size=1>10),-<FONT color=#ff00ff
size=1>1));
newlow=Cross<FONT color=#000000
size=1>(Ref<FONT color=#000000
size=1>(LLV<FONT color=#000000
size=1>(L,10<FONT
color=#000000 size=1>),-1<FONT
color=#000000 size=1>),L);
MAavg=MA<FONT color=#000000
size=1>(C,10<FONT
color=#000000 size=1>);
PlotOHLC<FONT color=#000000
size=1>(O,H,L,C,<FONT color=#ff00ff
size=1>"close"<FONT color=#000000
size=1>,colorWhite,styleCandle);<FONT color=#0000ff
size=1>
Plot(MAavg,<FONT color=#ff00ff
size=1>"ma"<FONT color=#000000
size=1>,colorYellow,styleLine);<FONT
face="Courier New" color=#000000 size=1>
nbuy=newlow;
nSell=Cross<FONT color=#000000
size=1>(C,MAavg);
Buy=ExRem<FONT color=#000000
size=1>(nBuy,nSell);
Sell=ExRem<FONT color=#000000
size=1>(nSell,nBuy);
Count=<FONT face="Courier New" color=#000000
size=1>SellPrice-BuyPrice<FONT color=#000000
size=1>;
PlotShapes<FONT color=#000000
size=1>(Buy*shapeDownArrow,colorGreen);<FONT
color=#0000ff size=1>
PlotShapes<FONT color=#000000
size=1>(Sell*shapeUpArrow,colorRed);<FONT
color=#0000ff size=1>
Plot(Count,<FONT color=#ff00ff
size=1>"count"<FONT color=#000000
size=1>,colorBlue,styleLine);
Filter=1<FONT color=#000000
size=1>;
AddColumn(BuyPrice,<FONT
color=#ff00ff size=1>"bp",<FONT
color=#ff00ff size=1>1.3);<FONT
color=#0000ff size=1>
AddColumn(SellPrice,<FONT
color=#ff00ff size=1>"sp",<FONT
color=#ff00ff size=1>1.3);<FONT
color=#0000ff size=1>
AddColumn(Count,<FONT
color=#ff00ff size=1>"c",<FONT
color=#ff00ff size=1>1.3);
KK Send
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Yahoo! Groups Sponsor
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
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.
|