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:
[email protected] [mailto:[email protected]] On Behalf Of laster
Sent: Tuesday, October 10, 2006 21:21
To:
[email protected]
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. L

 

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

 

 

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html





SPONSORED LINKS
Investment management software Investment property software Investment software
Investment tracking software Return on investment software

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to