Strategy TwoLegStandard
What the strategy does
TwoLegStandard is a two-leg relative-value strategy. Instead of trading one symbol in isolation, it tracks two instruments as a pair and reacts when their behavior diverges.
When an entry condition is met, the strategy opens a hedged pair:
- buy one instrument and sell the other;
- or the opposite direction, depending on the signal type.
This structure is designed to focus more on the relationship between instruments (spread/divergence) and less on pure market direction. In practical terms, you are trading whether the pair should move back toward balance, not just whether one symbol goes up or down.
The lifecycle is straightforward for users:
- the strategy waits for a valid divergence signal (Gap or Basket mode);
- opens both legs as one combined position;
- manages the position using your risk and exit settings (spread filters, TP/SL, confirmations, close rules);
- optionally adds more slots in grid mode if drawdown conditions are met.
The overall goal is to capture the recovery of the pair after divergence while keeping execution controlled through filters, confirmations, and position-management rules.
Typical professional use cases:
- Same instrument, different brokers: for example, EURUSD feed/execution on Broker A versus EURUSD feed/execution on Broker B. This is commonly used for cross-broker relative-value and execution-quality opportunities.
- Spot versus Futures structure: pairing a spot symbol with its futures equivalent to trade temporary dislocations in the spot-futures relationship.
- Cross-symbol correlation trading: using historically related instruments such as EURUSD-GBPUSD, US30-US100, or US100-DAX to trade short-term divergence and potential re-convergence.
In all three scenarios, the strategy should be viewed as a relationship-driven model: success depends on selecting pairs with stable behavior, tuning scaling correctly, and applying disciplined risk controls.
Customization
First of all, it is necessary to specify the brokers between which (accounts) will go. It is also necessary to specify the traded symbol.
Need Add 2 Providers here

starting/stopping the strategy
cloning a strategy to a new tab
Control panel


| Parameter | Simple explanation |
|---|---|
View Chart |
Shows the chart and strategy visualization (Chart Tab). |
View Orders |
Shows open/closed orders in the interface (Orders Tab). |
View Debug |
Shows additional technical diagnostics (Debug Tab). |
Save Trace to File |
Saves the strategy run history ticks for later review in BackTester. |
Scheduler |
Limits trading by time, if configured. (Can set on Dashboard>>>Shedulers) |
Allow Open Long |
Allows open long-direction entries. |
Allow Open Short |
Allows open short-direction entries. |
Send signals: Long / Short / Close |
Manual open/close orders from the software buttons. |
Using this buttons you can save/load preset (set file) of algorithm settings.
![]()
Algorithm Settings – all parameters giude
| Setting | What it controls | Practical tip |
|---|---|---|
Digits |
Price precision of leg 1. | Must match the quote format of instrument 1. |
Digits 2 |
Price precision of leg 2. | Must match the quote format of instrument 2. |
PriceMultipliers |
Scales both legs into a comparable price range before signal evaluation. | Critical for cross-asset pairs and cross-broker setups. |
Volume1 |
Base transaction volume for leg 1 (Broker/Provider 1). | In grid mode, volume can increase by slot. |
Volume2 |
Base transaction volume for leg 2 (Broker/Provider 2). | Keep leg sizing aligned with your hedge logic. |
Contract Size 1 |
Contract size for leg 1, used in money P/L calculation. | Always verify with broker symbol specification. |
Contract Size 2 |
Contract size for leg 2, used in money P/L calculation. | Incorrect values will distort total P/L behavior. |
EntryMode |
Selects entry signal family: Gap or Basket. |
Gap is usually easier for initial tuning. |
Slots Count |
Maximum number of simultaneously managed trade combinations (grid slots). | 1 = single-entry mode, 2+ = multi-slot/grid mode. |
Execution Control |
Execution-speed and order-handling control module settings (if available in your build/UI). | Use stricter execution constraints in volatile sessions. |
Drowdawn(pt) |
Drawdown threshold that allows opening the next slot. | Lower value means faster slot expansion and higher risk. |
Wait Before New Slot Combination(ms) |
Minimum time gap between new entries. | Helps prevent overtrading during noisy ticks. |
Use Auto Shift |
Enables automatic quote alignment between providers. | Use this when your pair has a dynamic quote offset. |
Auto Shift Period |
Update period for automatic alignment. | Lower value = faster reaction, higher value = smoother behavior. |
Manual Shift Bid(pt) |
Manual Bid shift (points) for alignment when auto shift is disabled. | Use only in manual alignment mode. |
Manual Shift Ask(pt) |
Manual Ask shift (points) for alignment when auto shift is disabled. | Keep Bid/Ask shifts consistent to avoid signal bias. |
Use Max Spread |
Enables spread filter for new entries. | Recommended in live trading conditions. |
Max Spread(pt) |
Maximum allowed spread for entry eligibility. | Tune per symbol and session liquidity. |
OpenGap(pt) |
Minimum gap value required to open a trade in Gap mode. |
Primary trigger threshold for Gap entries. |
OpenGapConfirmation.* |
Time-persistence filter for Gap signals. It confirms sustained divergence, not only short spikes. | Example: with OpenGap=100, Period=300ms, Threshold=80, the signal must reach 100 and remain above 80 for at least 300 ms. |
OpenBasket(pt) |
Entry threshold for the synthetic Basket indicator. | Used only when EntryMode = Basket. |
OpenBasketConfirmation.* |
Confirmation filter for Basket entries. | Same confirmation concept as Gap (period + threshold persistence). |
SmartClose |
Dynamically adjusts close behavior with respect to current trade slippage. | Helps make TP/SL handling more execution-aware. |
SameMarginAccount |
Special logic for shared-margin environments. | Enable only if this reflects your account structure. |
TakeProfit(pt) |
Profit target in points. | Most relevant for single-slot operation. |
Total TakeProfit($) |
Total money-based take-profit for all open slots. | Main close target for multi-slot/grid mode. |
TakeProfitConfirmation.* |
Time-based confirmation for profit exit. | Closes only when profit condition persists for the configured period. |
StopLoss(pt) |
Loss threshold in points. | Mandatory risk boundary; validate on history. |
StopLossConfirmation.* |
Time-based confirmation for stop-loss exit. | Reduces exits caused by brief price spikes. |
UseCloseGap |
Allows exit using reverse-gap conditions. | Useful as an additional close mechanism. |
CloseGapPt |
Gap threshold used by the close-gap logic. | Active only when UseCloseGap is enabled. |
MinLockDuration(secs) |
Minimum holding time before close conditions are allowed. | Prevents premature exits right after entry. |
EntryMode options
Entry Mode this main option using for calculation signals.

Gap
Entry based on current divergence in pips between instruments with shift and filters applied. This is usually the most straightforward mode for beginners.
Use OpenGap(pt) for set open orders using Gap mode.

Basket
Entry based on basket behavior relative to a baseline pair state. This mode typically needs more careful threshold tuning.
OpenBasket(pt) for set open orders using Basket mode.
PriceMultipliers mode (for trade between different instruments (pair trading)
![]()
PriceMultipliers is used to compare instruments with very different price ranges.
Example idea:
- if one instrument is around 1.10 and the other is around 42000, you cannot compare them directly;
- with multipliers, you scale one leg up/down so the strategy can compare them correctly.
How to set it
Format: leg1_multiplier;leg2_multiplier
Ready calculation example (EURUSD + GBPUSD):
m1 = 1m2 = Price1 / Price2PriceMultipliers = "m1;m2"
For Example:
EURUSD Price = 1,14174GBPUSD Price = 1.33553m2 = 1,14174 / 1.33553 = 0.85PriceMultipliers = "1;0.85"
Martingale mode via Slots
In TwoLegStandard, martingale logic is implemented as a slot sequence (grid steps). Each slot is an independent two-leg combination (Buy/Sell or Sell/Buy) managed by its own state.
How slot logic works step by step
- Slot 0 (first slot) opens on the standard strategy signal (
GaporBasket). - Slot 1 and above can open only when the previous slot drawdown is below
-Drowdawn(pt). - Every slot follows the same lifecycle: waiting for signal -> opening both legs -> locked management -> closing.
- If pair integrity is broken inside a slot (one leg present, the other missing), the slot is moved to forced closing mode.
How volume grows (martingale multiplier)
In the current implementation, when Slots Count > 1, each next slot uses doubled size:
- Slot 0: x1
- Slot 1: x2
- Slot 2: x4
- Slot 3: x8
This multiplier is applied to both Volume1 and Volume2.
What “martingale when Slots >2” means
In practice, this is a configuration with at least 3 levels (for example slots 0-1-2). The strategy can average deeper during adverse movement, but this also increases margin load and floating risk significantly.
How the grid closes in multi-slot mode
- Main automatic close condition for
Slots Count > 1is total basket profit reachingTotal TakeProfit($). - Closing can also be triggered by manual
Closesignal or schedulerCloseAllaction. - When
SameMarginAccountis enabled, a dedicated (virtual-close) handling path is used.
TakeProfit(pt)/StopLoss(pt)/UseCloseGap) are fully used mainly in single-slot mode. In grid mode (Slots Count > 1), the key automatic exit is Total TakeProfit($).Safety recommendations
- Start with
Slots Count = 1and validate stability on historical data. - Move to 2-3 slots only after stable single-slot behavior.
- Do not set
Drowdawn(pt)too low, or slots will stack too fast. - Always set a realistic
Total TakeProfit($)and monitor margin headroom. - Before live deployment, test worst-case scenarios for maximum simultaneously open slots.
Real practic of using martingale in TwoLegStandart Algo between XAUUSD and US30 pairs
First need add 2 Providers. 1 leg this XAUUSD and 2 leg this US30. You can use same account or different accounts.

Next we need calculate and set PriceMultipliers
Provider1 Price XAUUSD = 4053.30
Provider2 Price US30 = 52345.90
We do calculation Provider1 Price/Provider2 Price = 4053.30 / 52345.90 = 0,077
Next Set PriceMultipliers = "1;0,077"
If you click Start, you will see in the Diagnostics tab that Provider 1 and Provider 2 prices are now displayed in the same format.

Next we need set Digits and Digits 2
In Market Watch we see that Prices are displayed with 2 decimal places.

So we need set.
Digits=2;
Digits2=2;
! Be careful: different instruments may have different Digits