[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Easy Lang Prob



PureBytes Links

Trading Reference Links

> I tried this, but the trades don't take place as the high and low
> pivots are taken out but at strange places in between the peaks and
> troughs. 

I don't have these PivotHighVS/PivotLowVS functions.  Are they in 
TS2k?  (I'm on TS4.)  So I can't try this myself to see what's going 
on.

How about you send me a GIF of a chart with the system on it, showing 
where it buys & sells?  And indicate where the pivot function thinks 
the pivots are.  Maybe that will give me an idea of what's happening.

Oh, one thing comes to mind:  if this PivotHighVS function returns -1 
if it doesn't find a pivot, that might cause a problem.  The trouble 
is, if the pivot function returns a -1 until it finds a pivot, then 
suddenly returns the H or L value when it does find one, it might 
cross the current bar's H or L as it goes from -1 to the pivot value. 
 E.g. if the previous pivot was 1400, and the current H is 1390, and 
then the previous pivot goes "out of range" of the PivotHighVS 
function, then PivHigh goes from 1400 to -1, and "H crosses over 
PivHigh" is TRUE.

You might try making sure you never compare the H/L to a value that 
might be -1 on the current or previous bar.  Maybe something like 
this?

PivHigh = PivotHighVS( ... );
if PivHigh <> -1 then begin
  GoodPivHigh = PivHigh
  if H crosses over GoodPivHigh then...

That way you don't compare H to something that bounces between -1 and 
a valid pivot value.  GoodPivHigh always has a valid pivot value.  
There might still be a problem since it will have the PREVIOUS pivot 
value until it finds a new one, and you might run into problems if 
the good pivots bracket the H.  E.g. if the old pivot was 1400, then 
PivHigh goes to -1 while it can't find a pivot, then it finds a pivot 
at 1380 at a time when the H is 1390, GoodPivHigh will change from 
1400 to 1380 -- and H "crosses over" GoodPivHigh even though it 
hasn't crossed over 1380.  (Actually GoodPivHigh has "crossed under" 
H, but the two tests are equivalent in EL.)

Gary