PineCodersTASC

TASC 2023.09 The Weekly Factor

█ OVERVIEW

TASC's September 2023 edition of Traders' Tips features an article written by Andrea Unger titled “The Weekly Factor", discussing the application of price patterns as filters for trade entries. This script implements a sample trading strategy presented in the article for demonstration purposes only. It explores how the strategy's equity curve might benefit from filtering trade entries using a specific price pattern.


█ CONCEPTS

Pattern filters represent valuable tools that assess current market conditions based on price movements and determine when those conditions become more favorable for trade entries.

The filter used and tested in this article is a metric called the "weekly factor", which measures the price range over the last five trading days and compares it to the open of the session five days ago and the close of the session one day ago (i.e., the "body" of the five-day period). When the five-day body is small compared to the five-day range, this could indicate "indecision" or "compression", potentially followed by a price expansion. Thus, the weekly factor metric can help identify areas in the market where a period of compression might signal a potential breakout.

This script demonstrates the use of the weekly factor for a sample intraday trading strategy (intended for educational and exploratory purposes only). In this strategy, the entry signal is triggered when a 15-minute bar breaks out of the previous day's high-low range, and the position is closed at the end of the day.


█ CALCULATIONS

The script uses two timeframes:

• The strategy entries are processed on the 15-minute timeframe.

• The weekly factor is obtained from the daily timeframe using the request.security function and the following formula:

math.abs(open[5] - close[1]) < RangeFilter * (ta.highest(5)[1] - ta.lowest(5)[1])

Here, RangeFilter is an input that can be optimized to find the favorable ratio between the five-day body and the five-day range. Smaller RangeFilter values will lead to fewer trade entries. A RangeFilter value of 1 is equivalent to turning off the filtering altogether.

Tools and ideas for all Pine coders: www.tradingview.com/u/PineCoders/
Pine news broadcasts: t.me/PineCodersSquawkBox or twitter.com/PineCoders
TASC: traders.com/
开源脚本

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

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?