OPEN-SOURCE SCRIPT

Quickfingers Luc base scanner - version 2

已更新
This is my second implementation of a Pine Script Quickfingers Luc (QFL) base scanner that I have published on Trading View. QFL base scanners seek to provide buy signals according to the QFL trading strategy. To profitably trade using this script you should be familiar with the QFL trading strategy, scaling in and out of positions, and money risk management.

Background

All the QFL base identification Pine Scripts that I have inspected to date use a simple candlestick pattern of two lower lows followed by two higher lows to identify a base. Some scripts may combine this with a volume indicator as well. In practice, I found the results of this approach to be somewhat unreliable. The candlestick pattern may identify some significant bases, may identify minor bases (that should not be traded), but at the same time miss other significant bases entirely!

My first QFL base scanner sought to use Pine Script’s built in ta.lowest and ta.highest functions to identify bases and peaks. This approach depended on the time period selected to find the lowest lows and highest highs. This approach can be problematic because significant bases may be formed outside the nominated time period, leading to the identification of minor bases within the time period. I have left the first version of my QFL base scanning script in the Trading View indicators because it uses a different approach to this script that other people may still find useful.

My second version of the QFL base scanner does not use the Pine Script ta.lowest and ta.highest functions, and therefore does not rely on nominating a time period to look back through data.

User inputs

This script steps through the price data to find the following patterns that are used to confirm bases and peaks.

Base – bounce of x% above previous base confirms that base
Peak – fall of y% below previous peak confirms that peak
Buy signal – fall of z% below the base signals a buy signal.

x%, y% and z% are user configurable through the script settings. Small percentages will provide more, but riskier, buy signals; larger percentages will provide fewer, but safer, buy signals.

The script identifies QFL bases and buy signals and marks them on the price chart. These are able to be turned on and off in the script settings. The settings also allow the user to turn on plots for peaks, lowest lows and highest highs. These are not useful for applying the QFL trading strategy, but are calculations used in finding bases and can be useful for the user to understand what the script is doing in the background.

Troubleshooting

If looking at the past script results, you may think that the script is perfectly timing entry points at the bottom of market dips. This is NOT the case. The script is actually showing buy signals when the price falls z% below the PREVIOUS base. The current base is only retrospectively marked some periods later once the reversal is confirmed – a solid line marks a confirmed base in real time; a dotted line retrospectively repaints the line to the actual base. New bases are not tradeable using this script, but a percentage fall from the previous base is – this is the QFL trading strategy.

Pine Script may flag that this script has a repainting issue. Pine Script defines repainting as, “script behavior causing historical vs realtime calculations or plots to behave differently.” In the case of this script, bases are confirmed once the price has bounced x% off the low. The script then repaints a dotted line from the base that has been identified in real time (with a solid line) back to the point in the price data where the base actually occurs. The dotted line only aids in visual identification of the base, and does not impact on the real time identification of bases. A similar repainting issue occurs for identifying peaks. I have identified the lines in the script that cause this repainting. These lines can be commented out without affecting the buy signals generated by the script, but you will also lose the visual pinpointing of historical bases and peaks.

The user may find price charts where they think that the script has not correctly identified a base or peak. Usually, careful measurement will reveal that the price chart has not confirmed a base or peak by moving x% or y% from the previous base or peak respectively.

And before you ask, yes, Trading View alerts work with this script.

Enjoy.
版本注释
I have added the ability to find bases using a volatility-based function to confirm moves. I had always planned to add this capability, but had not done it for the initial release of the script.

In using the original script, I found that the manual percentage function used to confirm the move from the previous base or peak worked for about 90% of charts. For charts with high or low volatility, different settings needed to be used to find significant bases. By finding bases using a volatility-based function to confirm moves, the script can more easily adapt to assets with different volatility.

The volatility measurement is based on a modified average true range indicator. The standard average true range indicator provides a discrete number. I wanted a volatility filter that was meaningful across different assets, so modified the average true range to be based on a percentage of the asset’s price. The user can input a multiplication factor to change the magnitude of the moves based on the volatility.

I have left the original ability to manually specify the percentage for the move up to confirm a base (x%), and the move down to confirm a peak (y%). However, I found that there was not much point in having separate values for x% and y%. The new script makes both values equal and only requires one input.

The manual percentage and volatility-based percentage perform differently across different time periods.

The manual percentage will find the same bases and buy signals across different time periods. The only time this will vary is when the granularity of the price data is insufficient to find intra-period significant price moves. For example, running the script on a one-week time period will not include all the intra-day moves that, for example, a one-hour time period would.

The volatility-based percentage is calculated from the average true range for the time period of the chart. Therefore, the measured volatility will change for a five-minute chart versus a one-hour chart. This can produce quite useful results if looking at different time periods. Note also that the volatility used to confirm bases and peaks will change over time because the volatility of assets changes over time. The script writes the current average true range percentage to the Trading View data window (as the variable Move %) allowing the user to monitor the changing percentage required to confirm a change in price direction.
版本注释
This is a cosmetic update to the script. The underlying base crack identification methodology has not changed.

Updates include:
  • Changed terminology from 'peak' to 'top' to improve readability of the script.
  • Amended tool tips to make them more self-explanatory.
  • Implemented single buy signal per base crack accessible through the user settings.
  • Added a box to show the buying range. Note that this box will repaint as price falls.
basecrackbasescannerqflquickfingersquickfingerslucSupport and Resistance

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明