This strategy will enter into a Long position when (a) is formed, combined with (b) ATR is relatively low. Trailing stop loss is set based on ATR.
A pattern looks like this:
It is formed when lower-low has reached a local minimum followed by higher-lows.
By default, this script plots the (the local minimum) using green crosses. This line will extend to the right until the next is formed. The local minimum is considered as key level of support. For long position entry, entry price must be higher or equal to it.
On the other hand, a pattern looks like the exact opposite. Reversing the logic, it is a local maximum indicated by higher-highs followed by lower-highs. This is shown by red crosses.
Why use ATR to confirm entry:
Two reasons to enter when ATR is low:
1) Since trailing stop loss is based on ATR, entering the market when ATR is low means risking less for potentially high reward.
2) Low ATR often signals price consolidation. There are two favorable scenarios, either: (i) period of accumulation, or (ii) , ideally followed by breakout.
Determining whether ATR is low:
Relative lows are quantified out by using the method in my other script: Modified ATR Indicator
The method involves applying two-tailed hypothesis testing to assess whether ATR ( ie . by default lookback period of 5) has greatly deviated from a larger sample size ( ie . lookback period of 50). Assuming ATR is normally distributed and variance is known, then test statistic (z) can be used to determine whether ATR5 is within the critical area under Null Hypothesis: ATR5 == ATR50. If z falls below/above the left/right critical values ( ie . 1.645 for a 90% confidence interval), then ATR is determined to the relatively low/high respectively. For the purpose of assessing whether ATR is low, the left-tail is the main focus.
Profits by default are taken over 3 levels based on risk to reward ratio ( ie . 1R, 2R, 3R). When a target is met at each level, strategy will close out one third of current position size. Remainders ( ie . already taken once at 1R, but not yet reaching 2R or 3R) will eventually be closed at the trailing stop loss price.
В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.