INVITE-ONLY SCRIPT
Обновлено

[GYTS-Pro] Order Orchestrator

140
🎼 Order Orchestrator (Pro) 🎼
🌸 Part of GoemonYae Trading System (GYTS) 🌸


🌸 --------- INTRODUCTION --------- 🌸

💮 What is the Order Orchestrator?
The Order Orchestrator is a exhaustive trading strategy framework that acts as the central command center for your automated trading operations. It coordinates entries, exits, and position management based on signals from other GYTS and third party indicators, while offering flexibility in trade setup and risk management. Unlike traditional strategies that apply a one-size-fits-all approach, the 🎼 Order Orchestrator lets you build sophisticated, multi-layered trading systems that adapt to specific market conditions.

💮 Key Features at a Glance
Signal integration - Connect up to 5 independent signal sources with customisable mapping
Multi-level take profits - Deploy up to 5 dynamic take profit levels with percentage allocation
Adaptive position sizing - Implement anti/martingale position sizing based on win/loss streaks
Market regime filtering - Trade selectively in trending or cyclic market conditions
SuperTrend exit system - Utilise dynamic trailing stops that activate after specific TP levels
Numerous entry/exit methods - Utilise percentage, ATR, higher-high-lower-low-based entries and exits
Risk/reward-based TPs - Automatically place take profits based on risk-to-reward ratios
Third-party integration - Compatibility with PineConnector and custom API webhooks
Advanced signal consolidation - Require multiple signals within a window for trade confirmation
Visualisation options - Comprehensive visual feedback system for all aspect of your trades


🌸 --------- TRADE ORCHESTRATION SYSTEM --------- 🌸

💮 The Multi-Signal Engine
At its core, the Order Orchestrator processes signals from multiple sources and integrates them to make intelligent trading decisions:

Signal sources - Connect up to 5 independent signal generators, including GYTS indicators like 🧬 Flux Composer or a 📡 Signal Provider like WaveTrend 4D directly
Signal Mapping - Flexibly map integer values from signal streams to specific actions (entry long, exit short, etc.)
Signal Consolidation - As an alternative to using GYTS Flux Composer, you can set to require multiple confirmations within a specified bar window for stronger trade conviction.
Market Regime Filtering - Selectively enable signals based on the current market regime (trending or cyclic). Works with the GYTS Market Regime Detector out-of-the-box.

This multi-layered approach drastically reduces false signals while ensuring you don't miss genuine trading opportunities.

снимок


💮 Dynamic Entry System
The Order Orchestrator provides flexible entry methods to suit different trading styles:

Percentage-based - Enter at a fixed percentage away from the close price
ATR-based - Scale your entry distance based on current market volatility
HHLL-based - Enter at recent swing highs/lows for breakout or pullback trading
Limit or market orders - Choose between immediate execution or better price entries
Auto-cancellation - Automatically cancel pending limit orders after a specified number of bars
Cooldown period - Add a cooldown period between trades to limit persistent signals

снимок


💮 Adaptive Position Sizing
The Order Orchestrator includes a sophisticated position sizing system that can adapt to your recent trading results:

Win streak scaling - Increase position size during favourable market conditions (anti-martingale)
Loss streak management - Apply classic martingale strategy to recover from drawdowns
Customisable progression - Set minimum streak threshold and maximum multiplier to control risk
Multiplicative scaling - Position size grows geometrically with each consecutive win or loss

This approach allows you to capitalise on "hot streaks" while implementing a systematic recovery strategy during challenging periods.

снимок


💮 Multi-Level Exit Strategy
Take full control of your exit strategy with a sophisticated multi-tiered approach:

Percentage Allocation - Divide your position across up to 5 take profit levels with precise allocation control
Dynamic Take Profits - Set TPs using percentage, ATR, or HHLL-based methods
Risk/Reward Ratios - Automatically calculate TPs based on your desired risk-to-reward profile
Sequential SL Movement - Automatically move your stop loss when earlier TPs are hit
SuperTrend Exit Integration - Activate trailing stops after specific TPs are reached
Signal-Based Exits - Configure whether exit signals close positions or move stops to breakeven

This granular exit control allows you to lock in profits early while letting winners run with appropriate protection.

снимок



🌸 --------- CONFIGURATION GUIDE --------- 🌸

💮 Time Settings
Control when your strategy is active:

Training Period Filter - Restrict strategy operation to specific date ranges for testing or scheduled trading

💮 Entry Settings
Configure how the strategy enters trades:

Order type - Choose between market orders (immediate execution) or limit orders (better price)
Limit order expiration - Set the number of bars after which pending limit orders are cancelled
Global cooldown - Specify a waiting period after trade exit before allowing new entries
Entry price calculation - Select from percentage-based, ATR-based, or HHLL-based methods

💮 Martingale Settings
Configure position sizing based on consecutive wins or losses:

Win/loss multipliers - Set the factor by which position size increases after wins or losses
Min/max streak - Define the minimum streak required and maximum application of multipliers
Example progression - With multiplier=2, min_streak=1, max_streak=4, sizes would follow: 1-2-4-8-16-16...

💮 Stop Loss Settings
Configure the initial stop loss placement:

Distance method - Choose from percentage-based, ATR-based, or HHLL-based methods
Parameters - Customise value and lookback periods depending on the selected method

💮 Take Profit Settings
Configure up to 5 take profit levels:

Allocation - Set what percentage of your position closes at each level
Distance method - Choose from percentage-based, ATR-based, HHLL-based, or R:R-based methods
SL movement - Determine how stops move when each TP hits (none, breakeven, to a previous TP)
SuperTrend activation - Enable trailing stops after specific TP levels are reached

💮 Signal Generation Settings
Connect external indicators as signal sources:

Signal sources - Connect up to 5 independent indicators, with automatic parsing of GYTS 🧬 Flux Composer & 📡 Signal Providers. Also with a built-in EMA crossover for testing.
Signal mapping - When using custom sources, define which values from data streams correspond to entry/exit signals
Regime Activity - Specify whether signals are active in trending markets, cyclic markets, or both.

Note that the GYTS 🧬 Flux Composer already consolidates multiple 📡 Signal Providers, and therefore should be the only source in the Order Orchestrator when following the GYTS methods. However, you could also configure two or three 🧬 Flux Composers, one for each regime.

💮 Signal Consolidation Settings
Configure how multiple signals are processed:

Window size - Set the number of bars over which to consolidate signals
Minimum signals - Require a minimum number of signals within the window for entry/exit
Exit strategy - Choose how exit signals are handled (market close, move SL, or reverse trade)

Note that the GYTS 🧬 Flux Composer does this in a more sophisticated manner, and this section is unnecessary when using the 🧬 Flux Composer.


🌸 --------- AUTOMATED TRADING --------- 🌸

Configure alerts for external execution platforms:

PineConnector - Format alerts compatible with MT4/MT5 through PineConnector
Custom API - Create webhooks for platforms like 3Commas, Cornix, CryptoHopper, etc.

💮 Automation with PineConnector

When using PineConnector, after having it set up following the official documentation, it is important to use the following settings:

(1) In TradingView, the Condition of the Alert should be "alert() function calls only". Also don't forget to use the correct webhook address and enable it.

(2) In this strategy’s Properties tab: use “% of equity” for the Order size as is also the metric that will be communicated with PineConnector/MetaTrader for each trade.

(3) In PineConnector’s Input tab in Syntax section:
  • Target Type (sl= and tp=): "Pips"
  • Volume Type (risk=): "% of Balance, Margin" (or based on "Loss", but that is not how this strategy is calculating the order sizes)
  • Pending Order Entry (price=): "Pips from Current Market Price"


Note that due to the (current) limitations of PineConnector, (partial) take-profits (TPs) are triggered on bar close as market orders even though in TradingView they are limit-order TPs. Therefore, exit prices will vary. The only exception is when only using TP1 (with 100% allocation), then it is a limit order in PineConnector as well. Stoplosses are also always limit orders.

💮 Automation with Custom API
Background how the custom API alerts are computed:
  • There are four alerts: long/short entry and long/short close. This means that positions are fully closed. Therefore, make sure to disable TP2 and if you wish to use TP1, set it to 100% allocation. There are also validation steps implemented to ensure correct usage.
  • We calculate whether limit orders — i.e. entry (when "limit order" is selected), SL and TP1 — are hit, by checking whether the price reached the value of these orders. If so, the alert is triggered. The moment of triggering depends on the settings in “Properties” > “Recalculate”.



🌸 --------- PRACTICAL USAGE GUIDE --------- 🌸

💮 Setting Up Signal Sources
The Order Orchestrator is designed to work with external signal sources from the GYTS suite or custom indicators:

1. GYTS 🧬 Flux Composer & 📡 Signal Providers:
• Set Signal Source to "🔗 STREAM-int" of the relevant GYTS indicators
• In case of multiple outputs, e.g. with WaveTrend 4D (Pro), you should set two streams:
• Primary: "🔗 STREAM-int WT4D 📡 Gradient Divergence Measure"
• Secondary: "🔗 STREAM-int WT4D 📡 Quantile Median Cross"

2. Market Regime Detector Integration:
• Enable Market Regime filter
• Connect to "🔗 STREAM-int - 🧊 Market Regime"
• Note that this is a pretty straightforward filter -- "trade only longs", "only shorts", "both directions (cyclic)" and you could use other indicators for this as well.
• Configure which signals are active in trending vs. cyclic regimes

3. Testing with Built-in Signals:
• As a default, the test signal option (EMA crossover) is enabled
• This ensures that the indicator works out-of-the-box, but you should probably use more sophisticated signals
• You can also use this EMA strategy to validate your exit strategy, position sizing, and overall configuration


💮 Crafting a Multi-Tier Take Profit Strategy
A well-designed take profit strategy is crucial for maximising profitability:

1. Conservative Approach:
• TP1: 50% allocation at 1:1 R:R ratio
• TP2: 30% allocation at 2:1 R:R ratio, move SL to breakeven
• TP3: 20% allocation at 3:1 R:R ratio, move SL to TP1
• Great for higher timeframe trades with considerable volatility

2. Aggressive Scaling:
• TP1: 30% allocation at 0.5:1 R:R ratio
• TP2: 30% allocation at 1:1 R:R ratio, move SL to breakeven
• TP3: 20% allocation at 2:1 R:R ratio, move SL to TP1
• TP4: 10% allocation at 3:1 R:R ratio, move SL to TP2
• TP5: 10% allocation at 5:1 R:R ratio, activate SuperTrend
• Perfect for trending markets with strong momentum (good combination with certain settings of the GYTS 🧊 Market Regime Detector)

3. Activating SuperTrend Exit:
• Enable SuperTrend exit at later TPs (e.g., TP3 or TP5)
• This creates a trailing stop for the remaining position
• Connect a compatible SuperTrend indicator for dynamic stops


💮 Optimising for Different Market Regimes
The 🎼 Order Orchestrator truly shines when customised for specific market conditions:

1. Trending Market Configuration:
• Connect to 🧊 Market Regime Detector
• Enable trend-specific signals (e.g., WaveTrend 4D QMC)
• Use R:R-based take profits with trailing stops
• Consider anti-martingale position sizing to capitalise on momentum

2. Cyclic, Range-Bound Market Configuration:
• Enable cycle-specific signals (e.g., WaveTrend 4D GDM)
• Use percentage or ATR-based entries/exits
• Consider tighter take profits with smaller allocations
• Keep stop losses relatively tight

3. Hybrid Approach:
• Let Market Regime Detector automatically switch between configurations
• Use different signal sources for different regimes
• Adapt position sizing based on market predictability


🌸 --------- CONCLUSION --------- 🌸

The 🎼 Order Orchestrator represents the culmination of hundreds of hours of development, testing, and refinement. By providing an incredibly flexible framework for trade execution, it addresses the fundamental challenge: how to systematically enter and exit positions while managing risk effectively across different market conditions.

What sets the 🎼 Order Orchestrator apart is its ability to act as the central nervous system of your trading operation, intelligently processing inputs from various signal sources and executing a sophisticated trading plan with precision. When combined with other components of the GYTS suite, it forms a complete trading ecosystem that can adapt to virtually any market condition.

• 🧊 Market Regime Detector for environment analysis
• 🧬 Flux Composer(s), which consolidate 📡 Signal Providers, for signal generation
• 🎼 Order Orchestrator as the execution framework

We encourage you to start with conservative settings and gradually customize the configuration to match your trading style, risk tolerance, and objectives. The combination of robust entry methods, multi-level take profits, adaptive position sizing, and regime-specific behaviour provides almost limitless possibilities for optimisation.

Your feedback is very valuable in our ongoing quest to create the most effective trading tools possible. Note that this is pushing the limits of TradingView's runtime, a higher-tier TradingView plan may be helpful. As you discover new applications and configurations for the 🎼 Order Orchestrator, please share your experiences to help the entire GYTS community grow and succeed.
Информация о релизе
  • Fixed bug where profit (and thus order sizing) was not calculated correctly due to TV's decimal precision
  • Disable PineConnector messages where risk=0.000
  • Changed SL messages/identifiers to be more descriptive
  • Some refactoring of order size calculation and more comments
  • Fixed bug where SuperTrend would still be drawn when it wasn't enabled
Информация о релизе
  • Improved UI with more and clearer grouping
  • Removed redundant settings and added more user input validation
  • Significantly altered storage of variables, especially of TPs
Информация о релизе
  • Updated tracking of consecutive trade statistics
  • Changed Martingale logic to reset when the maximum multiplier is reached, except when that trade ends on break-even
  • Solved bug when using testing strategy (EMA crosses)
  • Updated several calculations to be more efficient, so script should become slightly faster
Информация о релизе
  • Solved bug of not updating to correct initial entry size in some Martingale scenarios
Информация о релизе
  • Simplified and corrected martingale order sizing logic
  • Getting empty price from the open position rather than calculated price (solves potential issues with gaps)
  • Slightly more efficient order statistics calculations
  • Added drawdown & runup statistics in table
  • Refactored code for more consistency
Информация о релизе
  • Added tooltips for Signals section regarding the mapping
  • Fixed SuperTrend display bug
  • Increased trade ID from 3 numbers to 4, to account for strategies with more than 999 trades.
Информация о релизе
Major update
  • Migrated to Pine Script v6 + refactoring
  • SuperTrend implementation completely rewritten
  • Changed independent TP variables to arrays
  • Fixed small bugs
Информация о релизе

  • Major refactoring completed -- improved code, but managing almost 3000 lines in Pine Script is a hassle
  • Compatible with Market Regime Detector
  • Extended to 5 sets of external signals
  • Each signal can be traded during trending and/or cyclic markets
  • Lots of bug fixes
  • Better and more tooltip documentation
Информация о релизе

  • New: Flux Composer, WT4D, manual input signals
  • New: Cooldown period between trades
  • Better statistics tracking
  • Various bug fixes on different combinations of parameters

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.