INVITE-ONLY SCRIPT

Flux Charts - S&D Automation

1562
💎 GENERAL OVERVIEW
The MTF Supply & Demand Zones (S&D) Automation is a powerful and versatile tool designed to help traders rigorously test their trading strategies against historical market data. With various advanced settings, traders can fine-tune their strategies, assess performance, and identify key improvements before deploying in live trading environments. This tool offers a wide range of configurable settings, explained within this write-up.

cuplikan

Features of the new S&D 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 Supply & Demand Zone conditions, with settings like Sensitivity, Zone Invalidation, Minimum Zone Width & Minimum Zone Length settings for refined strategy execution.


🚩UNIQUENESS
The S&D 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, S&D Automation provides a highly detailed parameter set, allowing traders to fine-tune their strategies with precision.

Multi-Timeframe Supply & Demand Zones – This is the first-ever tool that allows traders to backtest Supply & Demand zones on multiple timeframes.

Customizable Take-Profit Conditions – Offers various methods to set take-profit exits, including using core features from Supply & Demand Zones, 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 Supply & Demand Zones 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, S&D Automation ensures that traders can rigorously test and optimize their strategies with great accuracy and efficiency.

cuplikan

📌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.

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 for Supply & Demand Zones. 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 S&D Automation can use the following conditions for entry conditions :

1. Demand Zone
Detection: Triggered when a Demand Zone forms or is detected
Retest: Triggered when price retests a Demand Zone. A retest is confirmed when a candle enters a Demand Zone and closes outside of it.
2nd Retest: Triggered when price retests a Demand Zone for the second time. A retest is confirmed when a candle enters a Demand Zone and closes outside of it.
3rd Retest: Triggered when price retests a Demand Zone for the third time. A retest is confirmed when a candle enters a Demand Zone and closes outside of it.
Retracement: Triggered when price touches a Demand Zone
Break: Triggered when a Demand Zone is invalidated by candle close or wick, depending on the user's input.

2. Supply Zone
Detection: Triggered when a Supply Zone forms or is detected
Retest: Triggered when price retests a Supply Zone. A retest is confirmed when a candle enters a Supply Zone and closes outside of it.
2nd Retest: Triggered when price retests a Supply Zone for the second time. A retest is confirmed when a candle enters a Supply Zone and closes outside of it.
3rd Retest: Triggered when price retests a Supply Zone for the third time. A retest is confirmed when a candle enters a Supply Zone and closes outside of it.
Retracement: Triggered when price touches a Supply Zone
Break: Triggered when a Supply Zone is invalidated by candle close or wick, depending on the user's input.

3. Any Zone
Detection: Triggered when any Supply or Demand Zone forms or is detected
Retest: Triggered when price retests any Supply or Demand Zone. A retest is confirmed when a candle enters any Supply or Demand Zone and closes outside of it.
2nd Retest: Triggered when price retests any Supply or Demand Zone for the second time. A retest is confirmed when a candle enters any Supply or Demand Zone and closes outside of it.
3rd Retest: Triggered when price retests any Supply or Demand Zone for the third time. A retest is confirmed when a candle enters any Supply or Demand Zone and closes outside of it.
Retracement: Triggered when price touches any Supply or Demand Zone
Break: Triggered when any Supply or Demand Zone is invalidated by candle close or wick, depending on the user's input.

🕒TIMEFRAME CONDITIONS

The S&D Automation supports Multi-Timeframe (MTF) features, just like the Supply & Demand indicator. 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 S&D Zone conditions and 1 Source condition. Each condition can be enabled or disabled using the checkbox on the left side of them.
  2. The next selection is the alert type, which you can select between "Detection", "Retest", "Retracement" or "Break".
  3. You can select which timeframe this condition should work on from Timeframe 1, 2, or 3. If you select "Any Timeframe", the condition will work for all timeframes.
  4. 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 S&D 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, for which you can set its activation level as well. The Trailing stop activation level and its value are expressed in ticks. Check this scenario for an example :

  1. We have a ticker with a tick value of $1. Our Trailing Stop is set to 10 ticks, and the 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 must 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
  • Demand Zone Detection, Step 1
  • Supply Zone Retest, Step 2
  • Demand Zone Break, Step 2
  • open > close, Step 3


  1. First, the strategy needs to detect a Demand Zone Detection in order to start working.
  2. After it's detected, now it's looking for either a Supply Zone Retest, or a Demand Zone Break 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 candlesticks for the condition open > close. If a bullish candlestick 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/

cuplikan

⚙️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.
  • 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. General Configuration
  • Detection Method: There are two detection methods you can choose from for identifying Supply & Demand Zones. Both methods aim to identify key areas where price is likely to react, but they do so using different approaches. Traders can choose the method that aligns with their trading style and time horizon.
  • Sensitivity: The Sensitivity setting allows traders to adjust how aggressively the script identifies supply and demand zones when using the Momentum Detection Method. This setting directly impacts the threshold for detecting zones when using the momentum detection method.
  • Zone Invalidation: The Zone Invalidation setting determines how supply and demand zones are invalidated.

    Wick -> A zone is invalidated if a candle’s wick goes below a demand zone or above a supply zone.

    Close -> A zone is invalidated if a candle closes below a demand zone or above a supply zone.
  • Zone Visibility Range: The Zone Visibility Range setting controls how far from the current price supply and demand zones are displayed on the chart. It helps traders focus on relevant zones while avoiding clutter from distant or less impactful areas.
  • Minimum Zone Width: The Minimum Zone Width setting defines the smallest size a supply or demand zone must have to be displayed on the chart. It uses the Average True Range (ATR) as a reference to ensure zones are proportionate to current market volatility.
  • Minimum Zone Length: The Minimum Zone Length setting determines the minimum number of bars a supply or demand zone must span to be displayed on the chart. This setting helps filter out short-lived or insignificant zones, ensuring only meaningful areas of supply or demand are highlighted.


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


4. 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, 2nd Retest, 3rd 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.


5. 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.

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.