Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 6/26/2011 Posts: 128
|
I am interested in a pcf for testing moving averages by computing
the net gain loss (over 500 periods) of a system that buys when the heiken ashi open is above the moving average
and selling when heiken ashi open is below the moving average.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
TC2000 does not have any built in backtesting features and I do not know of any way to write such a formula.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/26/2011 Posts: 128
|
Thank you.
|
|
Registered User Joined: 6/26/2011 Posts: 128
|
Oh. I am wondering if it may be possible to get it by computing the average
buying prices versus the average selling prices.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
What is the period and average type of the moving average? Is that moving average applied to the HA Open, the HA Close or something else?
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/26/2011 Posts: 128
|
For example, it would be avgc10, where c is normal (not HA) close.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The moving average crossing up through the HA open.
SUM(IIF(XUP(AVGC10, (XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1) / 4), C, 0), 489) / CountTrue(XUP(AVGC10, (XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1) / 4), 489)
The moving average crossing down through the HA open.
SUM(IIF(XDOWN(AVGC10, (XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1) / 4), C, 0), 489) / CountTrue(XDOWN(AVGC10, (XAVGO3.1 + XAVGH3.1 + XAVGL3.1 + XAVGC3.1) / 4), 489)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/26/2011 Posts: 128
|
Thank you. I am only interested in comparing to the value of
the moving average at the beginning of the period (i.e C.0=O.0) - it seems that the above
may occur intraperiod(?).
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
No, it is only testing at the crossups and crossdowns. Why do you think otherwise?
If you change all instances of 489 to something lower (that matches) you can see the points at which the averages change.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/26/2011 Posts: 128
|
The formula looks correct. But it is updating more often than I expected (count increasing).
How can I send you an example?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Keep in mind if you change the period to something lower, the value will change both when a new price gets added and when an older price that is no longer in the period gets dropped.
Please send it to my attention at:
support@tc2000.com
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/26/2011 Posts: 128
|
Thank you. Actually it looks good now... There were simply more crossovers than
I had expected to see. But a minor problem occurs when there is a tie between the ha open
and moving average. I would only want to count such ties as having the previous sign.
(otherwise a bounce produces a buy and sell - but one certainly can live with that).
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Well the numbers probably aren't actually tied in the literal sense if you take it out to enough digits.
Not sure if we would want to try to figure out a way to count stuff that is just close as a "tie". We would need to add a lookback of some sort to see which side the tie should be on and make sure it actually does count the cross it eventually "unties". That would reduce the number of bars we could check.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |