Posted 7/4/2008 12:15:38
|
|
|
|
| I created a "detrended price ocillator" and used it for input to a "times series forcast". It shows very nicely on the chart but when I try getting the previous value using the "lookback" all I get is NAN... Walt >> I attached a small project to demonstrate...
|
|
Posted 7/4/2008 17:34:50
|
|
|
|
It looks like your try block is waiting for the 101st bar before it executes, was that intended? If so, do you have enough history available?. Also, Current is the same thing as LookBack(0) so "if(dpoTsf.Current < dpoTsf.LookBack(0))" will always be false.
HTH,
Mark
|
|
Posted 7/4/2008 19:09:43
|
|
|
|
| thanks mark, the 100 bars wait was intended since I suspect it requires quite a few bars to calc... >> The lookback(0) was a translation mistake as I usually code in VB... it was supposed to be lookback(1)... In any case, I think the issue is with the DPO, since it only returns NAN in the code... Walt
|
|
Posted 7/6/2008 14:47:46
|
|
|
|
| The DPO is calculated as the Close – (the SMA from ((n / 2) + 1) days in the FUTURE). Since RightEdge doesn't allow indicators to actually look into the future, the most recent 11 values of a 20-period DPO will always be NaN. In short, I would think twice about using the DPO. Daniel
|
|
Posted 7/6/2008 17:08:36
|
|
|
|
| Thanks Daniel, Since I did know <<RightEdge doesn't allow indicators to actually look into the future>> (which is great)... I did not think that it would let me use indicators that do. Can you mark or list the indicators that use future bars so I can insure I do not use them; This one indicator, DPO, cost me a lot of time trying to integrate it into my strategy... Had I known it used future bars, iwould not have tried to get it to work... Thanks! Walt BTW; the "zig Zag" uses future bars and does not show the graph on the most recent bars; If all the future indicators behaved this way that would be a good visual cue that it uses future bars...
|
|
Posted 7/6/2008 23:22:28
|
|
|
|
| All future indicators do work that way. If you look at the most recent bars for you will see that they don't have any value for the DPO. In code, you can look at the OldValuesChange property of an ISeries to determine whether values for previous bars can change. If this is true then the indicator is probably looking into the future in some way. Note that the indicator is responsible for returning this value so an incorrectly written indicator could return the wrong result. The built-in indicators that return true for this property are: Detrended Price Oscillator (DPO) Linear Regression Trendline Tirone Levels (Upper, Lower, and Center) Zig Zag Thanks, Daniel
|
|
|
|