Optuma Pivot Script Not Working Correctly

Hi team

I have been using Darren’s breakout pivot script to identify potential areas of support:

//Define the pivot criteria
V1=PIVOT(MIN=15, TYPE=Low);
//Get the current high price and when the last V1 pivot occurred
L1=LOW();
V2=VALUEWHEN(LOW(), V1);
//Calc 1% rule
WITHINRANGE(V2,L1,PERCENT=1.00)

When I backtested a buy within 1% of a prior low - I found the backtest cheating and taking trades on the day a new pivot formed as opposed to an existing pivot (at that time).

What’s a possible way to test this style of pivot support?

Thank in advance

Mandeep

 

Hi Mandeep,

This is a known issue when using the PIVOT function in testing because the labels can change depending on new data coming in to the chart. As such, pivot scripts should only be used to display on the chart, and not for testing.

Instead you could use values of swing lows instead of pivots using something like this, but I haven’t tried it in testing:

//Define swing criteria
GS1 = GANNSWING(SWINGCOUNT=2, METHOD=Use Next Bar, USEINSIDE=True);
V1 = SWINGSTART(GS1);
//Get the current low price
L1=LOW();
//Is it within 1% of the most recent swing low?
(L1/V1 > 1) and (L1/V1 < 1.01)

Thanks Darren - I tested this signal and it looks like this one is cheating too.

Would it work better if you use:

GS1.SwingStart

I am looking a hack solution - what do you think of this: trying to force the system to at least have a 5day lag between the last pivot low ??

V1=PIVOT(MIN=10, TYPE=Low);

TIMESINCESIGNAL(V1<=-11) > 5

 

 

 

Hi guys,

Just wondering whether this problem was addressed in Optuma 2. If not, is it scheduled/planned for a future release?

Thanks

Kim

Hi,

[postquote quote=67815]

In Optuma 2 the Pivot() function has an option to ignore unconfirmed pivots, so only those that won’t change when new data comes in are included in the criteria.

V1 = PIVOT(IGNOREUNCONFIRMED=True, MIN=10) ;
V1 > 0 or V1 < 0

In this example you can see the Show Bar tool ignores the last pivot label (light grey) as it is currently unconfirmed:

Ex2

This is for current data only, historical data still has an issue that it knows a pivot is there, before it is actually confirmed.

Pivots still shouldn’t be used for backtesting because of this, not without adding in some extra code to not take a pivot into account until x bars after a pivot label (TimeSinceSignal() for example).