An improved version for minimum and maximum in a day trading session. You can choose the session resolution, it ranges from 1 minute to 1 week.
It works well for stocks and non-extended sessions due to security() function limitations.
Any suggestions, please leave a comment.
Maximum Drawdown and Maximum Relative Drawdown% calculating functions.
I needed a way to calculate the maxDD% of a serie of datas from an array (the different values of my balance account). I didn't find any builtin pinescript way to do it, so here it is.
There are 2 algorithms to calculate maxDD and relative maxDD%, one non optimized needs n*(n - 1)/2...
Determines local maximums and minimums points in the chart.
lookback : number of candlesticks to look.
extrema_finder_sensivity : If lower, more extreme points will be found (may over-find).
Brief algorithm description:
Computes a Simple Moving Average (length= extrema_finder_sensivity ), and searches for its local extremes.
Given some SMA...
Draws minimum and maximum prices as a line chart for four different time frames.
1) The last 21 bars (close price)
2) The last 50 bars (close price)
3) The last 100 bars (close price)
4) The last 200 bars (close price)
Min/ Max values usually provide important resistance/ support levels.
Minimum and maximum points in a day trading session. It may help you spot the range which min and max occur in a session.
In day trading, for example, at securities like GBPNZD, minimum happens between 02:00-05:00 ET and maximum between 08:00-14:00 ET. This indicator can help you test this hypothesis.