♥ 0 |
Is there a way to create a watchlist column to show the number of consecutive bullish or bearish candles for a stock in the watchlist? Thank you. RESOLVED
Marked as spam
|
Private answer
We can barrow some code from a similar solution based on the TTM Trend indicator. That solution is located here: https://www.hahn-tech.com/ans/ttm-trend-consecutive-bar-count/ However it depends on how one defines a "Bullish" bar and a "Bearish" bar. We have two choices:
You did not specify which of these you wanted to use so I will provide a solution which is based on option 1:
If you wanted to change that to use option 2 then you would modify the first two lines of code as follows:
However if you do that the names of those variables should be updated to avoid confusion. But I'll leave that task up to you. Marked as spam
|
Please log in to post questions.