TradingView
Trendoscope
2022년 8월 17일 오전 12시 53분

SubCandle 

Bitcoin / United States DollarCoinbase

설명

I created this script as POC to handle specific cases where not having tick data on historical bars create repainting. Happy to share if this serves purpose for other coders.

What is the function of this script?
Script plots a sub-candle which is remainder of candle after forming the latest peak.

  • Higher body of Sub-candle refers to strong retracement of price from its latest peak. Color of the sub-candle defines the direction of retracement.
  • Higher wick of Sub-candle refers to higher push in the direction of original candle. Meaning, after price reaching its peak, price retraced but could not hold.


Here is a screenshot with explanation to visualise the concept:



Settings

There is only one setting which is number of backtest bars. Lower timeframe resolution which is used for calculating the Sub-candle uses this number to automatically calculate maximum possible lower timeframe so that all the required backtest windows are covered without having any issue.

We need to keep in mind that max available lower timeframe bars is 100,000. Hence, with 5000 backtest bars, lower timeframe resolution can be about 20 (100000/5000) times lesser than that of regular chart timeframe. We need to also keep in mind that minimum resolution available as part of security_lower_tf is 1 minute. Hence, it is not advisable to use this script for chart timeframes less than 15 mins.

Application
I have been facing this issue in pattern recognition scripts where patterns are formed using high/low prices but entry and targets are calculated based on the opposite side (low/high). It becomes tricky during extreme bars to identify entry conditions based on just the opposite peak because, the candle might have originated from it before identifying the pattern and might have never reached same peak after forming the pattern. Due to lack of tick data on historical bars, we cannot use close price to measure such conditions. This leads to repaint and few unexpected results. I am intending to use this method to overcome the issue up-to some extent.
코멘트
NAK1987
NAK1987
This is amazing , what you have done here is a giant leap for TA and back testing...this is perfection .
Trendoscope
@NAK1987, thanks mate. I am building another version of it. Will be published soon. Just waiting to get some time from my regular day job :)
NAK1987
@HeWhoMustNotBeNamed, Awesome , look forward to it , not to sure how perfection could be made better but looking forward to seeing it ;)
NAK1987
NAK1987
Trendoscope
@NAK1987, you are crazy. What did you like so much in this? Yes I agree, there is some application. But, didn't expect someone like it that much.
NAK1987
@HeWhoMustNotBeNamed, Yes I think it deserves a place built in to trading views candle types . Sure , it allows us to see what happened with doji candles but it also helps to make resistance or support clusters very easy to spot too. Additionally, even if it is not a doji but still has a wick on the top or bottom for example , it is still showing what happened . So , I would argue that it could be very helpful for someone starting out in TA that might still be getting used to wicks, their importance and so on . This is special buddy . On another note I also have been using your zig zag candles supertrend indicator to build a scalping Strat for fun on the side. I'm huge fan of that one too :). As for the scalp strat, I am trying to keep it pretty simple, runs using 5 sec and 5 min charts at this time and I personally think it's easy to follow, so far have been having decent results with it but its early .So, I am going to continue to work at it and once I get things concrete with it , I will be sure to share results and so on :)
Trendoscope
@NAK1987, Here you go man. The next version as promised ;) tradingview.com/script/kMr9d0s0-SubCandles-V2/
NAK1987
@HeWhoMustNotBeNamed, Wow , so good , thanks buddy :)
더보기