PureBytes Links
Trading Reference Links
|
It's 12 hours later, but I don't see an answer to your question so,
You need to review the documentation for Backtesting Systems. Some
points to consider:
Buy DOES return True or False.
Buy also triggers the backtester to run.
BuyPrice is the price at which you Buy, which is normally the Open or
the Close of the same or the next bar.
There is also Sell, SellPrice, Short, ShortPrice, Cover, CoverPrice
Also look up SetTradeDelays().
For instance, Buy=Cross( C, MA(C,20 ) ); should be true when the cross
occurs. Right!
Reason2 will never be Null. The way you wrote it, it will be 1 (True) or
0 (False). (Well, it will be Null for the first 20 bars since the 20 day
MA cross is invalid until at least 20 days have gone by.)
You cannot set Buy = C;
You can set BuyPrice = C;
Remember, both of the above are ARRAYS. That is, they set ALL BARS at
the SAME TIME.
--
Terry
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On
Behalf Of laster
Sent: Tuesday, October 10, 2006 21:21
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Buy. False/True?
I was hoping the function Buy to return a False/True that I could use in
an if or while statement. I can't figure it out how to access it.
For instance, Buy=Cross( C, MA(C,20 ) ); should be true when the cross
occurs. Right? Wrong?
I am trying:
Reason2= Cross( C, MA(C,20 ) );
IIf(IsNull( Reason2), 0, Buy=C); Expecting a null value whenever there
is no cross, but it does not work.
Same results with IsEmpty and istrue.
If I try to access it with If, I don't know which part of the array to
call. :-(
Is there a way to look into the array Reason2 for debugging purposes?
I guess I should move the code to a dll and call it from AFL.
Thanks in advance for any thoughts.
Jerry
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.13.27/517 - Release Date: 11/3/2006
|