INVITE-ONLY SCRIPT
Güncellendi

Flux Charts - PAT Automation

1144
💎 GENERAL OVERVIEW
The PAT Automation is a powerful and versatile tool designed to help traders rigorously test their trading strategies against historical market data. With an array of advanced settings, traders can fine-tune their strategies, assess performance, and identify key improvements before deploying in live trading environments. This backtester offers a wide range of configurable settings, explained within this write-up.

anlık görüntü

Features of the PAT Automation:
  • Step By Step: Configure your strategy step by step, which will allow you to have OR & AND logic in your strategies.
  • Highly Configurable: Offers multiple parameters for fine-tuning trade entry and exit conditions.
  • Multi-Timeframe Analysis: Allows traders to analyze multiple timeframes simultaneously for enhanced accuracy.
  • Provides advanced stop-loss, take-profit, and break-even settings.
  • Incorporates volume-based conditions, liquidity grabs, order blocks, market structures and fair value gaps for refined strategy execution.


🚩UNIQUENESS
The PAT Automation stands out from conventional backtesting tools due to its unparalleled flexibility, precision, and advanced trading logic integration. Key factors that make it unique include:

Comprehensive Strategy Customization – Unlike traditional backtesters that offer basic entry and exit conditions, PAT Automation provides a highly detailed parameter set, allowing traders to fine-tune their strategies with precision.

Multi-Timeframe Price Action Features – This is the first-ever tool that allows traders to backtest price action with multi-timeframe features such as Fair Value Gaps (FVGs), Inversion Fair Value Gaps (IFVGs), Order Blocks & Breaker Blocks.

Customizable Take-Profit Conditions – Offers various methods to set take-profit exits, including using core features from price action, and fixed exits like ATR, % change or price change, enabling traders to tailor their exit strategies to specific market behaviors.

Customizable Stop-Loss Conditions – Provides several ways to set up stop losses, including using concepts from price action and trailing stops or fixed exits like ATR, % change or price change, allowing for dynamic risk management tailored to individual strategies.

Integration of External Indicators – Allows the inclusion of other indicators or data sources from TradingView for creating strategy conditions, enabling traders to enhance their strategies with additional insights and data points.

By integrating these advanced features, PAT Automation ensures that traders can rigorously test and optimize their strategies with great accuracy and efficiency.

anlık görüntü

📌HOW DOES IT WORK?
The first setting you will want to set it the pyramiding setting. This setting controls the number of simultaneous trades in the same direction allowed in the strategy. For example, if you set it to 1, only one trade can be active in any time, and the second trade will not be entered unless the first one is exited. If it is set to 2, the script will handle both of them at the same time. Note that you should enter the same value to this pyramiding setting, and the pyramiding setting in the "Properties" tab of the script for this to work.

For deep backtesting, you can set "Max Distance To Last Bar" to "Unlimited". If you encounter any memory issues, try decreasing this setting to a lower value.

You can enable and set a backtesting window that will limit the entries to between the start date & end date.

Then, you can enter your desired settings to Price Action features like FVGs, IFVGs, Order Blocks, Breaker Blocks, Liquidity Grabs, Market Structures, EQH & EQL and Volume Imbalances. You can also enable and set up to 3 timeframes, which you can use later on when customizing your strategies enter / exit conditions.

Entry Conditions
From the "Long Conditions" or the "Short Conditions" groups, you can set your position entry conditions. For settings like "initial capital" or "order size", you can open the "Properties" tab, where these are handled.

The PAT Automation can use the following conditions for entry conditions :

1. Order Block (OB)
Detection: Triggered when an Order Block forms or is detected
Retest: Triggered when price retests an Order Block. A retest is confirmed when a candle enters an Order Block and closes outside of it.
Retracement: Triggered when price touches an Order Block
Break: Triggered when an Order Block is invalidated by candle close or wick, depending on the user's input.

2. Breaker Block (BB)
Detection: Triggered when a Breaker Block forms or is detected
Retest: Triggered when price retests a Breaker Block. A retest is confirmed when a candle enters a Breaker Block and closes outside of it.
Retracement: Triggered when price touches a Breaker Block
Break: Triggered when a Breaker Block is invalidated by candle close or wick, depending on the user's input.

3. Fair Value Gap (FVG)
Detection: Triggered when an FVG forms or is detected
Retest: Triggered when price retests an FVG. A retest is confirmed when a candle enters an FVG and closes outside of it.
Retracement: Triggered when price touches an FVG
Break: Triggered when an FVG is invalidated by candle close or wick, depending on the user's input.

4. Inversion Fair Value Gap (IFVG)
Detection: Triggered when an IFVG forms or is detected
Retest: Triggered when price retests an IFVG. A retest is confirmed when a candle enters an IFVG and closes outside of it.
Retracement: Triggered when price touches an IFVG
Break: Triggered when an IFVG is invalidated by candle close or wick, depending on the user's input.

5. Break of Structure (BOS)
Detection: Triggered when a BOS forms or is detected

6. Change of Character (CHoCH)
Detection: Triggered when a CHoCH forms or is detected

7. Change of Character Plus (CHoCH+)
Detection: Triggered when a CHoCH+ forms or is detected

8. Volume Imbalance (VI)
Detection: Triggered when a Volume Imbalance forms or is detected

9. Equal High (EQH)
Detection: Triggered when an EQH is detected

10. Equal Low (EQL)
Detection: Triggered when an EQL is detected

11. Buyside Liquidity Grab
Detection: Triggered when a liquidity grab occurs at Buyside Liquidity (BSL).

12. Sellside Liquidity Grab
Detection: Triggered when a liquidity grab occurs at Sellside Liquidity (SSL).

🕒TIMEFRAME CONDITIONS

The PAT Automation supports Multi-Timeframe (MTF) features, just like the Price Action Toolkit. When setting an entry condition, you can also choose the timeframe.

To set up MTF conditions, navigate to the 'Timeframes' section in the settings, select your desired timeframes, and enable them. You can choose up to three timeframes.
Once you've selected your timeframes, you can use them in your strategy. When setting long and short entry / exit conditions, you can choose from Timeframe 1, Timeframe 2, or Timeframe 3.

External Conditions
Users can use external indicators on the chart to set entry conditions.

The second dropdown in the external condition settings allows you to choose a conditional operator to compare external outputs. Available options include:
  • Less Than or Equal To: <=
  • Less Than: <
  • Equal To: =
  • Greater Than: >
  • Greater Than or Equal To: >=


The position entry conditions work like this ;
  1. Each side has 5 Price Action conditions and 1 Source condition. Each condition can be enabled or disabled using the checkbox on the left side.
  2. For Price Action Conditions, you can set a direction: "Any", "Bullish" or "Bearish".
  3. Then a Price Action Feature, like "FVG" or "Order Block".
  4. The last part of our constructed condition is the alert type, which you can select between "Detection", "Retest", "Retracement" or "Break".
  5. Now you should have a constructed condition, which should look like "Bullish Order Block Retest".
  6. You can select which timeframe should this condition work on from Timeframe 1, 2 or 3. If you select "Any Timeframe", the condition will work for all timeframes.
  7. Lastly select the step of this condition from 1 to 6.


The Source Condition
The last condition on each side is a source condition that is different from the others. Using this condition, you can create your own logic using other indicators' outputs on your chart. For example, suppose that you have an EMA indicator in your chart. You can have the source condition to something like "EMA > high".

The Step System
  1. Each condition has a step number, and conditions are in topological order based on them.
  2. The conditions are executed step by step. This means the condition with step 2 cannot be executed before the condition with step 1 is executed.
  3. Conditions with the same step numbers have "OR" logic. This means that if you have 2 conditions with step 3, the condition with step 4 can trigger after only one of the step 3 conditions is executed.


OTHER ENTRY FEATURES
The PAT Automation allows traders to choose when to execute trades and when not to execute trades.

1. Only Take Trades
This setting lets users specify the time period when their strategy can open or execute trades.

2. Don't Take Trades
This setting lets users specify time periods when their strategy can't open or execute trades.

↩️EXIT CONDITIONS

1. Exit on Opposite Signal
When enabled, a long position will close when short entry conditions are met, and a short position will close when long entry conditions are met.

2. Exit on Session End
When enabled, positions will be closed at the end of the trading session.

📈TAKE PROFIT CONDITIONS
There are several methods available for setting take profit exits and conditions.

1. Entry Condition TP
Users can use entry conditions as triggers for take-profit exits. This setting can be found under the long and short exit conditions.

2. Fixed TP
Users can set a fixed TP for exits. This setting can be found under the long and short exit conditions. Users can choose between the following:

  • Price: This method triggers a TP exit when price reaches a specified level. For example, if you set the Price TP to 10 and buy TSLA at $190, the trade will automatically exit when the price reaches $200 ($190 + $10).
  • Ticks: This method triggers a TP exit when price moves a specified number of ticks.
  • Percentage (%): This method triggers a TP exit when price moves a specified percentage.
  • ATR: This method triggers a TP exit based on a specified multiple of the Average True Range (ATR).


📉STOP LOSS CONDITIONS

There are several methods available for setting stop-loss exits and conditions.

1. Entry Condition SL

Users can use entry conditions as triggers for stop-loss exits. This setting can be found under the long and short exit conditions.

2. Fixed SL
Users can set a fixed SL for exits. This setting can be found under the long and short exit conditions. Users can choose between the following:

  • Price: This method triggers a SL exit when price reaches a specified level. For example, if you set the Price SL to 10 and buy TSLA at $200, the trade will automatically exit when the price reaches $190 ($200 - $10).
  • Ticks: This method triggers a SL exit when price moves a specified number of ticks.
  • Percentage (%): This method triggers a SL exit when price moves a specified percentage.
  • ATR: This method triggers a SL exit based on a specified multiple of the Average True Range (ATR).


3. Trailing Stop
An explanation & example for the trailing stop feature is present on the write-up within the next section.

Exit conditions have the same logic of constructing conditions like the entry ones. You can construct a Take-Profit Condition & a Stop-Loss Condition. Note that the Take-Profit condition will only work if the position is in profit, regardless of if it's triggered or not. The same applies for the Stop-Loss condition, meaning that it will only work if the position is in loss.

You can also set a Fixed TP & Fixed SL based on the price movement after the position is entered. You have options like "Price", "Ticks", "%", or "Average True Range". For example, you can set a Fixed TP like "5%", and the position will be entered once it moves 5% up in a long position.

Trailing Stop
For the Fixed SL, you also have a "Trailing" stop option, which you can set it's activation level as well. The Trailing stop activation level and it's value are expressed in ticks. Check this scenerio for an example :

  1. We have a ticker with a tick value of $1. Our Trailing Stop is set to 10 ticks and activation level is set to 30 ticks.
  2. We buy 1 contract when the price is $100.
  3. When the price becomes $110, we are in $10 (10 ticks) profit and the trailing stop is now activated.
  4. The current price our stop's on is $110 - $30 (30 ticks), which is the level of $80.
  5. The trailing stop will only move if the price moves up the highest high the price has been after we entered the position.
  6. Let's suppose that price moves up $40 right after our trailing stop is activated. The price will now be $150, and our trailing stop will sit on $150 - $30 (30 ticks) = $120.
  7. If the price is down the $120 level, our stop loss will be triggered.


There is also a "Hard SL" option designed for a backup stop-loss when trailing stops are enabled. You can enable & set this option and if the price goes down before our trailing stop even activates, the position will be exited.

You can also move stop-loss to the break-even (entry price of the position) after a certain profit is achieved using the last setting of the exit conditions. Note that for this to work, you will need to have a Fixed SL set-up.

OTHER EXIT FEATURES

1. Move Stop Loss to Breakeven

This setting allows the strategy to automatically move the SL to Breakeven (BE) when the position is in profit by a certain amount. Users can choose between the following:

  • Price: This method moves the SL to BE when price reaches a specified level.
  • Ticks: This method moves the SL to BE when price moves a specified number of ticks.
  • Percentage (%): This method moves the SL to BE when price moves a specified percentage.
  • ATR: This method moves the SL to BE when price moves a specified multiple of the Average True Range (ATR).


Example Entry Scenario

To give an example, check this scenario; out conditions are :

LONG CONDITIONS
  • Bullish Order Block Detection, Step 1
  • Bullish CHoCH Detection, Step 2
  • Bullish Volume Imbalance Detection, Step 2
  • Bullish IFVG Retest, Step 3


  1. First, the strategy needs to detect a Bullish Order Block in order to start working.
  2. After it's detected, now it's looking for either a CHoCH, or a Volume Imbalance to proceed to the next step, the reason for this is that they both have the same step number.
  3. After one of them is detected, the strategy will consistently check all IFVGs for a retest. If the retest occurs, a long position will be entered.


ALERTS
This indicator uses TradingView's strategy alert system. All entries and exits will be sent as an alert if configured. It's possible to further customize these alerts to your liking. For more information check TradingView's strategy alert customization page: tradingview.com/support/solutions/43000531021-how-to-use-a-variable-value-in-alert/

anlık görüntü

⚙️SETTINGS

1. Backtesting Settings
  • Pyramiding: Controls the number of simultaneous trades allowed in the strategy. This setting must have the same value that is entered on the script's properties tab on the settings pane.
  • Max Distance to Last Bar: Determines the depth of historical data used to prevent memory overload.
  • Enable Custom Backtesting Period: Restricts backtesting to a specific date range.
  • Start & End Time Configuration: Define precise start and end dates for historical analysis.


2. Fair Value Gaps Settings
  • Zone Invalidation: Select between "Wick" and "Close" invalidation.
  • Filtering: Choose between "Average Range" and "Volume Threshold".
  • FVG Sensitivity: Ranges from Extreme to Low to detect FVGs with varying strictness.
  • Allow Gaps: Enables analysis on tickers that have different open-close price gaps.


3. Inversion Fair Value Gaps Settings
  • Zone Invalidation: Choose between "Wick" and "Close".


4. Order Block Settings
  • Swing Length: Adjusts the minimum number of bars required for OB formation.
  • Zone Invalidation Method: Select between "Wick" and "Close".


5. Breaker Block Settings
  • Zone Invalidation: Set invalidation method as "Wick" or "Close".


6. Liquidity Grabs Settings
  • Pivot Length: Adjusts the number of bars used to detect liquidity grabs.
  • Wick-Body Ratio: Defines the proportion of wick-to-body size for liquidity grab detection.

7. Multi-Timeframe Analysis
  • Enable Up to Three Timeframes: Select and analyze trades across multiple timeframes.

8. Market Structures
  • Swing Length: Defines the number of bars required for structure shifts.
  • Includes BOS, CHoCH, CHoCH+ Detection.


9. Equal Highs & Lows
  • ATR Multiplier: Defines the sensitivity of equal highs/lows detection.


10. Volume Imbalances
  • Gap Size Sensitivity: Ranges from "Ultra" to "Low".
  • Disable Overnight Gaps: Filters out volume imbalances occurring due to overnight gaps.


11. Entry Conditions for Long & Short Trades
  • Multiple Conditions (1-6): Configure up to six independent conditions per trade direction.
  • Condition Types: Options include Detection, Retest, Retracement, and Break.
  • Timeframe Specification: Choose between "Any Timeframe", "Timeframe 1", "Timeframe 2", or "Timeframe 3".
  • Trade Execution Filters: Restrict trades within specific trading sessions.


12. Exit Conditions for Long & Short Trades
  • Exit on Opposite Signal: Automatically exit trades upon opposite trade conditions.
  • Exit on Session End: Closes all positions at the end of the trading session.
  • Multiple Take-Profit (TP) and Stop-Loss (SL) Configurations:
  • TP/SL based on % move, ATR, Ticks, or Fixed Price.
  • Hard SL option for additional risk control.
  • Move SL to BE (Break Even) after a certain profit threshold.
Sürüm Notları
  • Various Optimizations

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.