PureBytes Links
Trading Reference Links
|
Hello Adrian,
here is a code sample that answers
your question in further detail:
// We want to abbreviate the simple moving average function for the sake of
better readability:
MA45 = <FONT face="Courier New" color=#800080
size=1>MA<FONT face="Courier New" color=#00008b
size=1>(<FONT face="Courier New" color=#ff6820
size=1>close,
45<FONT
face="Courier New" color=#00008b size=1>);<FONT face="Courier New"
color=#ff6820 size=1>
buy =
Cross<FONT
face="Courier New" color=#00008b size=1>(<FONT face="Courier New"
color=#ff6820 size=1>close<FONT face="Courier New" color=#00008b
size=1>, MA45);
sell =
Cross<FONT
face="Courier New" color=#00008b size=1>(MA45, <FONT
face="Courier New" color=#ff6820 size=1>close<FONT face="Courier New"
color=#00008b size=1>);
// For the precursor versions no. 3.59 of AmiBroker the capabilities were
limited to only a forward-reversal system such as this one!
// Note that you should remove the comments to activate the following two
statements:
// short = sell;
// cover = buy;<FONT face="Courier New" color=#00008b
size=1>
// As of AmiBroker version no. 3.59 there have been different short-cover
conditions possible such as these ones:<FONT face="Courier New"
color=#ff6820 size=1>
short =
Cross<FONT
face="Courier New" color=#00008b size=1>(<FONT face="Courier New"
color=#800080 size=1>MA<FONT face="Courier New" color=#00008b
size=1>(<FONT face="Courier New" color=#ff6820
size=1>close,
50<FONT
face="Courier New" color=#00008b size=1>), <FONT face="Courier New"
color=#ff6820 size=1>close<FONT face="Courier New" color=#00008b
size=1>);
cover =
Cross<FONT
face="Courier New" color=#00008b size=1>(<FONT face="Courier New"
color=#ff6820 size=1>close<FONT face="Courier New" color=#00008b
size=1>, <FONT face="Courier New" color=#800080
size=1>MA<FONT face="Courier New" color=#00008b
size=1>(<FONT face="Courier New" color=#ff6820
size=1>close,
40<FONT
face="Courier New" color=#00008b size=1>));
Try this code by copying it into the
Automatic Analyzer window and then activate the button named
Backtest.
Best regards,
Udo
<BLOCKQUOTE
>
-----Ursprüngliche Nachricht-----
<DIV
>Von:
Adrian
Zaremba
An: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Gesendet: Dienstag, den 22. April 2003
14:31 Uhr
Betreff: [amibroker] AFL selling and
short selling
Buy = Cross( Close, MA( Close, 45 ) );Sell = Cross( MA(
Close, 45 ), Close );I want to modify this code so after selling I
want to short sell, I tried this, but this doesnt work:Buy =
Cross( Close, MA( Close, 45 ) );Sell = Cross( MA( Close, 45 ), Close
);short = Cross( Close, MA( Close, 45 ) );cover = Cross( MA( Close, 45
), Close );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
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.
|