Hi,
Need some explanation as to what I'm doing wrong. I seem to be looking into the future but I'm not sure how! It has the effect of making "tommorrows" trade picks dissapear. Classic sign of looking into the future.
I've tried to avoid the usual pitfalls of the zig-zag related functions by writing my own "peak" function. This avoids percentages so I was hoping it would give a signal immediately, and not change later as Z-Z does. ( Yes, its a simple function that doesn't handle multiple days that close at the "peak", but thats OK for now. )
function Pk()
{
// There is a future referente at ref(C,1)
return IIf( C > Ref(C,-1) AND C > Ref(C,1), 1, 0 );
}
My position scoring code is where the problen lies - I think
PositionScore = IIf ( LIQUIDITY > LiquidityMin AND
C > ValueWhen(Pk( ),C,1),
10000 - StDev(C,stdDevPds) ,
0);
Near as I can figure, its the "C > ValueWhen" line
and/or the Pk() function.
The following price sequence would give me the error:
10-11(p)-10( v)-12(C>) -11
11(P) is the peak,
10(v) is the validation of the peak, there has to be a down day
12(C>) is a close greater that the peak, the system generates a "buy on open signal" for the following day
11 is the next day, and when I back test at the end of this day, the signal is gone.
I suspect that it has something to do with the fact that the 12C> day is another peak.
I do have "add artificial future bar ticked" in the settings if that makes a difference.
I am a newbie, but the way I see it, that Pk() is a fixed point, and should not changeable by minor perturbations in the price.
Must have got something wrong. Any thoughts would be appreciated!
Thanks
Robert Z