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. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?