TradingView
Trendoscope
Oct 26, 2022 2:06 PM

Divergence Backtester 

Ethereum / TetherKuCoin

Description

There is n number of possible ways in which we can backtest divergence and this is just a start :)

In this script, we are trying to count how many times the pivots made HH, HL, LH, LL after a particular divergence state.

An example of using data is as below:



The script keeps track of each pivot sentiment and resulting next pivot state. As mentioned in the chart snapshot, we can look at two of the previous pivot states and collect stats on how each of these state impacted price action.

As mentioned before, this is just tip of iceberg. Further combinations for which we can do backtest are:

1. m X n combinations of last pivot and last to last pivot divergence state
2. divergence combined with double divergence state.

Only issue to explore further is lack of space on the chart as tables can take up huge space.

PS: As you can see based on historical stats, probability of divergence impacting the change of trend is very low in most cases.
Comments
KioseffTrading
Great Work, V. !!
Trendoscope
@KioseffTrading, thanks man. Looking to give you back this when you enhance this further :)
TanHef
Thanks for sharing :) Could some table fields be highlighted such as the most recent pending pivot trend type? Or most recent changed fields? Great script!
Trendoscope
@TanHef, can be done. Probably highest number would be better option
Pip-Whisperer
Oh dang nice! im working on something like this, you beat me to it hahaha, good stuff!
Trendoscope
@Pip-Whisperer, there is always next time ;)
ositrades
Love the script, great effort and thanks! Not sure if it is possible, but if we are able to print the relevant table HH/LH/HL/LL counts inside the label at each pivot, that would just be perfect! Thanks
Trendoscope
@ositrades, Its there already right?
ositrades
@HeWhoMustNotBeNamed, don't think so. So what I mean is when at a pivot the title says for example "Bearish Against Trend (Uptrend-LL/LL)", it gives the last pivot trend count from table of HH,LH, e.g. "Bearish Against Trend (Uptrend-LL/LL); 63,268". Thanks
MaxMaserati
Please, Make a video to explain it.
More