SVKParticipant
Junior
Hi all,
small question on you knowledgeable guys.
I’m using Nicolas’s PRC Pivot point supertrend indicator and have just noticed small problem with multitimeframe trading system.
15 minute & 1 hour timeframes where strategy is executed on 15 min.
Rule is simple both 15 min & 1 hour PRC PPS must be RED for short condition to be valid.
However PRC PPS (PRC Pivot point supertrend) 15 min executes short trade despite 1 hour PRC PPS is still green.
Please see photo where I have graphed 1 hour PRC PPS and used vertical lines to highlight the issue.
First white vertical line shows where 15min timeframe thinks 1 hour turned RED but in fact 1 hour is still GREEN.
Second white vertical line shows actual 1 hour timeframe turning RED.
Trade was profitable on this occasion but there quite a few which are not profitable.
Would someone know how to correct this ?
Ps. It might have something to do with the way Pivot points are calculated.
Thank you
Would you mind sharing the code you are using? Are you using UPDATEONCLOSE or not while getting the Supertrend value in 1-hour timeframe?
SVKParticipant
Junior
Hi Nicolas,
I have tried with and without UpdateOnClose on 1hr timeframe and anomalies were still there.
After work I will provide you a code no problem.
Thank you very much for PRC PPS code as it works well with the single timeframe.
SVKParticipant
Junior
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
//1 Hour TF (get the trend of the 3 minute chart)
timeframe(10 minutes,updateonclose)
//Pivot point supertrend
indicator66, ignored, ignored = CALL "PRC_Pivot Point Supertrend"[2, 3, 200, 0, 0, 0](close)
c66 = (close > indicator66)
Long1hourCond = c66
//10 minutes strategy execution timeframe
timeframe(2 minutes,updateonclose)
//Pivot point supertrend
indicator1, ignored, ignored = CALL "PRC_Pivot Point Supertrend"[2, 3, 109, 0, 0, 0](close)
c1 = (close[2] > indicator1[2])
//EMAs
indicator2 = ExponentialAverage[14](close)
c2 = (close CROSSES OVER indicator2)
CondiLong1 = c1
CondiLong2 = Long1hourCond
Trigger = c2
//long
IF not OnMarket and Trigger AND CondiLong1 AND CondiLong2 THEN
buy 1 PERPOINT AT MARKET
sl = abs(close - indicator1) + 2*pipsize
tp = sl * 1
SET STOP LOSS sl
SET TARGET PROFIT tp
ENDIF
graph Trigger coloured(0,255,127) // GREEN
graph CondiLong1 coloured(255,165,0) // ORANGE Supertrend 2 minutes
graph CondiLong2 coloured(220,20,60) // RED Supertrend 10 minutes
It seems ok for me.
To make sure you are using the same values in the strategy than the ones displayed on your chart with the indicator, add these lines at the end of your probacktest code:
graphonprice indicator66
graphonprice indicator1
It will add the Pivot Point Supertrend of both timeframe into your price chart during backtest.
Also, verify that you are using the same timeframes in the code (10 minutes or 15 minutes?) and also the settings (period, ..) in your backtest and on your chart.
SVKParticipant
Junior
Hi Nicolas,
thank you very much for taking look at it.
It must be broken only on my end then.
I have attached a snapshot below where you can see that price on 10 minute chart didn’t go below Supertrend as indicated on 2 minute chart.
2 minute chart GRAPH indicates that Price on 10 minute chart crossed below Supertrend on 20 Sep 2023 15:18 but in fact price on 10 minute chart crossed below Supertrend an 1 hour and 12 minutes later at 16:30.
Graph (red line) on 2 minute shall not dip down any sooner than 16:30.
Are you sure that your Supertrend is set with: 2, 3, 200 settings on your 10-minutes chart?
Could you please add the 2 lines I gave, into the code of your strategy, launch a backtest and post the picture here? We must be sure that the indicators calculation made via CALL in your strategy results in the same ones than indicators applied on chart, thank you.
SVKParticipant
Junior
Hi Nicolas,
10 minute – PRC PPS = 2,3,200
2 minute – PRC PPS = 2,3,91
Please see attached photo as requested.
Looking at 2 minute chart both white lines (PRC PPS) went UNDER the price at 21:00 (26/09/2023) but on 10 minute chart PRC PPS changed folowing day 27/09/2023 at 08:00.