PureBytes Links
Trading Reference Links
|
Henry:
First of all, for going short, you don't use the AB function "sell". You
use "short". "Sell" closes out the long position, which was entered using the
"Buy" function. To go short, you use "Short" and to close out the short, you use
"Cover."
Second, to use the same type of expression to go short, you need not repeat
the Optimize statements as long as you continue to use the same coefficients n1,
n2, and n3. Once they are defined, there is no need to repeat them again. Your
Cond1 statement for short is correct (the only difference from the long entry is
the PDI<MDI). However, you should distinguish the long Cond1 from the Short
Cond1 by specifying Cond1L and Cond1S, otherwise AB uses the last one only, and
you will never go long.
Third, the Optimize statements use four arguments:
n1=Optimize("n1",15,12,20,1) means n1 is to be optimized starting with 12 and
ending with 20 in increments of 1. The default is 15. This is explained more
fully in the help file. If you optimize all 3 variables at the same time, it
will take 9*13*10 or 1170 steps. If you want to shorten the computer time, you
can increment in larger steps (like 2 or 3 rather than 1), then narrow down
later. After you optimize, you replace the default number with the optimized
number to run backtests. So, if you find that 20 is the optimized result for
buying and shorting, then you replace the number 15 with 20 before you do any
backtesting.
Finally, to answer your 3rd question, ADX() has a value that is calculated
every day. So, if you specify that ADX() today must cross above yesterday's
ADX() value times a coefficient in order to assign 1 to the buy statement (i.e.,
to generate a buy signal), then you can use the cross statement as specified in
the example.
Does this answer your questions? Good luck.
Al Venosa
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=henry_chau@xxxxxxxxxxxxxxx
href="">Henry Chau
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Friday, August 29, 2003 4:47
PM
Subject: Re: [amibroker] Help with
formula
Thanks Jason + Al Venosa,
Thanks Jason for the formula : that's exactly
what I want , just a slight correction about cond2
Cond1=PDI<FONT color=#000000
size=1>(14<FONT color=#000000
size=1>)>MDI<FONT color=#000000
size=1>(14<FONT color=#000000
size=1>);
Cond2=Cross<FONT color=#000000
size=1>(ADX<FONT color=#000000
size=1>(14<FONT color=#000000
size=1>),MDI<FONT color=#000000
size=1>(14<FONT color=#000000
size=1>));
Cond3=Cond1 AND Cond2;
Filter=cond3;
AddColumn(cond3,<FONT
color=#ff00ff size=1>"My Test");
Buy=Cond3;
Thanks Al Venosa for your input , I like your use
of ADX system . Can you please comment if I understand it correctly
BUY SIGNAL / LONG <FONT color=#000000
size=1>
n1=Optimize<FONT color=#000000
size=1>("n1"<FONT color=#000000
size=1>,15<FONT color=#000000
size=1>,12<FONT color=#000000
size=1>,20<FONT color=#000000
size=1>,1<FONT color=#000000
size=1>); //number that ADX must be less
than
n2=Optimize<FONT color=#000000
size=1>("n2"<FONT color=#000000
size=1>,18<FONT color=#000000
size=1>,10<FONT color=#000000
size=1>,22<FONT color=#000000
size=1>,1<FONT color=#000000
size=1>); //period of ADX, PDI, and MDI
n3=Optimize<FONT color=#000000
size=1>("n3"<FONT color=#000000
size=1>,0.4<FONT color=#000000
size=1>,0.1<FONT color=#000000
size=1>,1<FONT color=#000000
size=1>,0.1<FONT color=#000000
size=1>); //fraction of uptick move
Cond1=PDI<FONT color=#000000
size=1>(n2)>MDI<FONT color=#000000
size=1>(n2) AND ADX<FONT
color=#000000 size=1>(n2) < n1 AND <FONT color=#0000ff
size=1>ADX(n2) > n3*<FONT
color=#0000ff size=1>Ref(<FONT
color=#0000ff size=1>ADX(n2),-<FONT
color=#ff00ff size=1>1);
Buy=Ref<FONT color=#000000
size=1>(Cond1, -1<FONT color=#000000
size=1>);
SELL SIGNAL / SHORT<FONT
color=#000000 size=1>
n1=Optimize<FONT color=#000000
size=1>("n1"<FONT color=#000000
size=1>,15<FONT color=#000000
size=1>,12<FONT color=#000000
size=1>,20<FONT color=#000000
size=1>,1<FONT color=#000000
size=1>); //number that ADX must be less
than
n2=Optimize<FONT color=#000000
size=1>("n2"<FONT color=#000000
size=1>,18<FONT color=#000000
size=1>,10<FONT color=#000000
size=1>,22<FONT color=#000000
size=1>,1<FONT color=#000000
size=1>); //period of ADX, PDI, and MDI
n3=Optimize<FONT color=#000000
size=1>("n3"<FONT color=#000000
size=1>,0.4<FONT color=#000000
size=1>,0.1<FONT color=#000000
size=1>,1<FONT color=#000000
size=1>,0.1<FONT color=#000000
size=1>); //fraction of uptick move
Cond1=PDI<FONT color=#000000
size=1>(n2)<MDI<FONT color=#000000
size=1>(n2) AND ADX<FONT
color=#000000 size=1>(n2) < n1 AND <FONT color=#0000ff
size=1>ADX(n2) > n3*<FONT
color=#0000ff size=1>Ref(<FONT
color=#0000ff size=1>ADX(n2),-<FONT
color=#ff00ff size=1>1);
Sell=Ref<FONT color=#000000
size=1>(Cond1, -1<FONT color=#000000
size=1>);
Please explain further what the numbers in
the optimize ("n",?,?,?,?) refer to why is there 4 numbers?
And from your post
"If you prefer using Cross, you can modify Cond1 to:
Cond1=PDI(n2)>MDI(n2) and ADX(n2) < n1 AND <FONT
color=#0000ff>Cross(ADX(n2), n3*ref(ADX(n2),-1));<FONT
color=#000000>"
I don't understand Cross(ADX(n2), n3*ref(ADX(n2),-1))
. How can you have a cross if there is only one ADX
line ? Sorry about my poor understanding of AFL.
Also If I want to add a condition to the above Buy Search by only looking
for stocks which has been in consolidation for "x" days that is ADX < 15 or
20 for x days , how do I add the code?
Thanks again for your input guys
Cheers
HenrySend
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
ADVERTISEMENT
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.
|