Jump to content

Does 'repainting' invalidate graphical backtesting?

Recommended Posts


By 'graphical backtesting' I mean using the long/short position tool on TradingView.com.




Repainting can be a big problem while working out a trading strategy.
If you set up some indicators and look at the chart history it can be quite decieving, what may appear in the historical chart to be a great indicator that seems to create good signals on your chart when the lines cross, can actually turn out to be nowhere near as good in live trading because the historical chart only shows that indicator in a frozen moment in time, at the end of each price bar formation.
In practice you may find the indicator lines cross and uncross several times during each bar formation, rendering that indicator close to useless due to constant false signals that dont show on the historical chart.
This is one of the failings of the usual methods of time frame chart trading with indicators.


Link to comment

Can you see what 'strategy' I'm using by looking at that chart?  My backtesting suggests a 50% win rate, which is profitable with a 1:1.5 reward-to-risk. 

It's less than 50% successful with 1:2 on the indices, but makes more money.  Forex 'seems' to whipsaw more than the indices.  But ... need to test 100 times etc.

Link to comment
14 minutes ago, dmedin said:

Repainting can be a big problem while working out a trading strategy.

Depends what you mean by 'repainting' indicators. Most indicators repaint the current bar until bar close because the calculations change when the input data changes, once the bar has closed there is no more incoming data and the indicator is fixed. Most broker supplied indicators work like this but where indicators are written and uploaded by a community they may not.

Some indicators are designed to recalculate the previous n number of bars with each new bar close such as a 'centered' triangular moving average, this gives a smoothed curved fit. Or some indicators may 'backpaint' such as many examples of Zig Zag which delays printing a signal 3 - 5 bars then when confirmed backpaints the signal. Finally some indicators will rearrange signals for a better fit once subsequent bars have been printed, these are favoured by scam indy sellers who can show a perfect fit picture but in reality the indy performance is mixed.

  • Like 1
Link to comment

So basically it's not an issue.  What's really an issue is me jumping into trades before the MACD makes its crossing.  Getting a 'jump start' is, in my experience, less profitable than simply waiting for the confirmation.  :)

ProRealTime does not have graphical backtesting as far as I can see.  I could program this system partially but ultimately I think it has to be discretionary.  So you could program some of the parameters as follows, and set the system to alert you when the conditions are met, then you would review the trade and decide whether to enter and where to put your stop based on candle patterns etc.

Buy conditions:

  • Price < 200 EMA 

  • MACD crossed below signal line from above 0 

  • Bearish candle (e.g. bearish engulfing where current close is > than previous candle close and current open is >= previous candle open)

  • PSAR is above price (sell)

Sell conditions are the opposite.

I suppose if you wanted to fully automate it you could simply place the stop a couple of points below/above the PSAR and set TP to 1.5x the distance of the stop.

There are other buy conditions and variations such as:

* Buy when MACD rises above signal while both lines are above 0 on a bullish candle making a higher high with a stop just under the previous bullish candle

* Opposite for selling


And all sorts of other variations and optimizations are possible.  Slope of the 200 EMA?


Edited by dmedin
Link to comment

I'm SFB today and copied and pasted the wrong bit.

It should be:

SELL conditions:

  • Price < 200 EMA 

  • MACD crossed below signal line from above 0 

  • Bearish candle (e.g. bearish engulfing where current close is < than previous candle close and current open is <= previous candle open)

  • PSAR is above price (sell)

BUY conditions are the opposite.

Edited by dmedin
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Posts

    • Sainsburys full year earnings and Unilever’s first quarter trading update both say the same thing, UK consumers are in for higher prices. The war in Ukraine, supply chain issues and the effects of ongoing Covid all to blame.      
    • US Dollar (DXY) Daily Price and Analysis US Q1 GDP may stall the greenback’s advance. A 20-year high nears for the US dollar. The multi-month US dollar rally continues with the greenback printing a fresh high today ahead of the first look at US Q1 GDP at 12.30 GMT. The US dollar basket (DXY) has been boosted by renewed weakness in the Euro and the Japanese Yen, as investors move from lower-yielding to higher-yielding currencies, while safe-haven flows continue to benefit the greenback. The US growth release later in the session is expected to show a sharp slowdown from the robust Q4 figure of 6.9%. The markets are currently pricing in growth of just 1% for the first three months of this year, with the slowdown mainly due to a reduction in inventory accrual over the quarter. This release is unlikely to move the greenback, unless there is a large miss or beat, as the Fed believe that 2022 US growth will be robust enough to let them tighten monetary policy sharply without damaging the economy. The latest US Core PCE data – the Fed’s preferred inflation reading – is released on Friday and this may have more effect on the US dollar than today’s GDP data. For all market moving economic data and events, see the DailyFX Calendar. The ongoing US dollar rally has been aided by weakness across a range of G7 currencies including the Euro, the Japanese Yen, and the British Pound. The Euro continues to battle with lowly growth expectations, exacerbated by energy concerns, the British Pound is mired by weak economic data, while the Japanese Yen is in freefall as the BoJ continues with its ultra-loose monetary policy.   The US dollar continues to press higher and looks set to break above 103.96, the March 2020 high. Above here the US dollar would be back at levels last seen nearly two decades ago. The March resistance will likely hold in the short-term, especially with month-end portfolio rebalancing at the end of the week, but US dollar strength is set to continue in the months ahead. USDOLLAR (DXY) WEEKLY PRICE CHART – APRIL 28, 2022 {{THE_FUNDAMENTALS_OF_BREAKOUT_TRADING}} What is your view on the US Dollar – bullish or bearish?   Apr 28, 2022 | DailyFX Nick Cawley, Strategist
    • While Tesla has nothing directly to do with Elon Musk buying Twitter - TSLA stock closed down 12% on news that Musk may have to sell stock and use other holdings to stand against the loan to finalise the purchase of the social media giant.        
  • Create New...