Platinum Customer
Joined: 10/20/2008 Posts: 357
|
Hi there,
I'm building a set of rules and 1 rule that I'd like to add is updating the moving average directly after the market closes such that we assume the open price for the following day equals that of today's closing price. This would therefore remove the oldest day in the moving average. By doing this, I will receive the stock signal much earlier and can act accordingly.
Alternatively, can I change the system date to 8 hours ahead so I can trick the system to update the moving average sooner?
How can I set this up?
Thanks
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You would need to have something different for each type of moving average.
You might want to try this instead. Add the following RealCode Indicator to your charts in the same pane and scale as price. Then add the moving average to this indicator instead of price. It will probably break if you set the period to anything negative, but 0 just reproduces the close and anything above zero shifts the close left and then holds that price.
'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Shift Left and Hold
'|******************************************************************
'#Period = UserInput.Integer = 1
If CurrentIndex <= Price.Count - Period - 1
Plot = Price.Last(-Period)
Else
Plot = Price.Bar.Value(Price.Count - 1)
End If
This means a moving average of this indicator is what it would be Period bars in the future if price stayed the same for that many additional bars.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|