Pyramiding (Position Scaling)

14. Pyramiding (Position Scaling)

Inp_Pyramid_Multiplier     = 3.0   // Scale multiplier (probe → main)
Inp_Pyramid_Max_Lots       = 2.0   // Hard cap: max lots for any single position
Inp_Pyramid_OnlyProfitable = true  // Pyramid only if last position is in profit

Logic:

  • No open positions: lots = target_lots / 3.0 — a small probe is opened (1/3 of normal)
  • Position exists: lots = last_volume × 3.0 — scaling up to full size
  • If OnlyProfitable = true and the last position is in loss → pyramid is blocked

Log: "Pyramid blocked: last position not in profit." / "LOT CAP: 4.50 -> 2.00"

Capital Management & Position Sizing

13. Capital Management & Position Sizing

Capital Modes (ENUM_CAPITAL_MODE)

ModeDescription
CAPITAL_COMPOUND_AUTOBase = account balance (automatic)
CAPITAL_FIXED_MANUALBase = Inp_Fixed_Capital_Amount (fixed)
CAPITAL_COMPOUND_AUTO + Inp_Compound_Enable=trueBase = Fixed + g_CompoundBuffer (from TXT file)

Position Sizing Algorithm (CalculatePositionSize)

1. base_capital = [depending on mode]
2. budget       = base_capital × MaxTotalMarginPercent / 100
3. risk_money   = budget × Risk_Percent_Per_Trade / 100
4. sl_ticks     = (Hard_SL_Points × _Point) / tick_size
5. loss_for_one_lot = sl_ticks × tick_value
6. target_lots  = risk_money / loss_for_one_lot

→ First position:      target_lots / Pyramid_Multiplier  (probe — smaller)
→ Subsequent position: last_volume × Pyramid_Multiplier  (main — larger)

7. Round to broker's volume step
8. Enforce broker's min/max volume
9. Check hard cap: Max_Lots
10. Margin check: OrderCalcMargin → if budget exceeded → abort

Compound Buffer

g_CompoundBuffer is read from an external TXT file. Allows percentage-based growth of the capital base at configurable intervals: Daily / Weekly / Monthly. Enables a compound interest effect on a locked base without changing EA settings.

Weekly Filter & Fibonacci (Anti-Crash)

12. Weekly Filter & Fibonacci (Anti-Crash)

Weekly Filter

Inp_WeeklyFilter_Enable = true
Inp_WeeklyFilter_TF     = PERIOD_W1

Blocks trading when the current price is below the previous week’s Low on W1. Protects against trading in a structurally bearish trend or during potential crashes.

Fibonacci Extension Filter

Inp_FiboFilter_Enable = true
Inp_Fibo_TF           = PERIOD_D1

Blocks orders at extreme Fibonacci extension levels on D1. Prevents entering an overheated market that has moved far from its fundamental value.

News Filter!

11. News Filter

Integration with an external economic calendar to protect against high-impact news events:

Inp_News_Filter_Enable = true    // Enable the filter
Inp_News_Mins_Before   = 30      // Freeze trading 30 mins before news
Inp_News_Mins_After    = 12      // Continue freeze for 12 mins after news
Inp_News_Block_High    = true    // Block on high-impact events (red)
Inp_News_Block_Mid     = true    // Block on medium-impact events (orange)

When the news filter is active → no new orders are opened. Existing positions continue to be managed normally.

Trading Schedule & EOD Terminator

10. Trading Schedule & EOD Terminator

Session Schedule (Terminal Local Time)

Each weekday has its own trading window:

Monday:    Inp_Hours_Monday    = "00:00-22:00"
Tuesday:   Inp_Hours_Tuesday   = "00:00-22:00"
Wednesday: Inp_Hours_Wednesday = "00:00-22:00"
Thursday:  Inp_Hours_Thursday  = "00:00-22:00"
Friday:    Inp_Hours_Friday    = "00:00-05:00"  // earlier close — weekend risk

Format: "HH:MM-HH:MM" — multiple ranges per day can be entered, comma-separated, e.g. "09:00-12:00,15:00-20:00". Saturday and Sunday are automatically blocked.

EOD Terminator

An emergency mechanism for closing all positions at a defined time:

Friday:     Inp_EOD_Time_Friday    = "21:39"
Other days: Inp_EOD_Time_OtherDays = "22:29"

Algorithm with retry logic:

  1. Attempts to close all positions on the symbol
  2. If the broker rejects an order → waits 5 seconds → retries (up to 10 attempts)
  3. On success: g_Last_EOD_Day = dt.day_of_year (does not repeat on the same day)

Log: "EOD TERMINATOR: Emergency closing all positions..." → "EOD SUCCESS: Closed position #123." → "EOD TERMINATOR: Chart cleared. Goodnight."

Account Protection — System Level

8. Account Protection — System Level

Daily Loss Hard Limit

If daily P/L drops below -(Inp_Daily_Loss_HardLimit)% of balance:
  → g_DailyLossReached = true
  → ALL new orders blocked for the rest of the day
  → Existing positions continue to be managed

Default: 4% of balance.

Drawdown Freeze

If current drawdown > Inp_Drawdown_FreezeLimit%:
  → g_DrawdownFreeze = true
  → New orders frozen

Default: 0.5% (very conservative, ideal for prop firm challenges).

Daily Target Profit

If daily P/L > +Inp_Daily_Target_Profit%:
  → g_DailyTargetReached = true
  → Trading stopped — profit is secured

Default: 15% — after reaching the target, the system shuts itself down for the day.

Equity Trailing Lock (Master)

An equity protection mechanism operating at the account level:

If equity rises by >= Inp_Equity_TSL_Trigger%:
  → Sets an "equity high watermark"
  → If equity drops below (high - Inp_Equity_TSL_Buffer%):
     → Closes ALL positions immediately

Default: Trigger 5%, Buffer 0.2%. Protects against losing a large intraday gain.

Position Management — Protection Layers

7. Position Management — Protection Layers

ManageAllPositions() executes on EVERY tick for every open position. Protection layers are applied in a strict priority order.

Layer 0: Virtual Stop Loss (Highest Priority — Emergency Cut)

This is not an SL sent to the broker — it is an internal loss-level monitor:

active_cap = base_capital (depending on mode)
pos_profit = profit + swap + commission
max_loss   = active_cap × Inp_Virtual_SL_Percent / 100

If |pos_profit| >= max_loss → immediate position close

Log: "VIRTUAL SL HIT! Position #123 loss (-45.23) exceeded 4.00% of Active Capital (1132.50). Closing immediately."

This safeguard acts as the last line of defence against a catastrophic loss, regardless of spread, slippage or broker conditions.

Layer 0.5: Profit Lock (Aggressive Trailing Near TP)

Activates when price approaches TP within Inp_E_PL_Trigger_Points (500 pts):

  • Enables an aggressive trailing SL based on Inp_E_PL_TSL_Points (200 pts) from the current price
  • SL only moves in the direction of profit (ratchet — never backwards)
  • Protects accumulated profit just before TP is hit

Log: "Position #123: PROFIT LOCK Activated!"

Layer 1: Physical TSL BB (Bollinger Band Trailing SL)

A two-phase mechanism:

  • Phase 1: Standard Hard SL sent to the broker at the time of opening
  • Phase 2: Activates when profit_in_points >= Inp_E_ProfitToActivateBB (1,500 pts)

Once Phase 2 is active:

  • BUY: SL = MAX(BB_Lower, open_price + floor_dist) — follows the lower BB band (never below open + floor)
  • SELL: SL = MIN(BB_Upper, open_price - floor_dist) — follows the upper BB band

TSL BB has higher priority than Hard BE — once Phase 2 is active, Hard BE is ignored.

Log: "Position #123 entered Phase 2 (TSL BB)."

Layer 2: Hard Break-Even (Classic BE)

Moves the physical SL to (or above) the entry price when profit reaches Inp_HardBE_Trigger_Points (200 pts):

BUY:  new_SL = open_price + (Inp_HardBE_Level_Points × _Point)   // e.g. +100 pts
SELL: new_SL = open_price - (Inp_HardBE_Level_Points × _Point)

SL is only moved in the direction of profit. Once activated, the flag is_breakeven1_set = true — Hard BE is never repeated.

Log: "Position #123: Hard Break-Even set at +100 pts."

Layer 3: Virtual Negative Break-Even

An innovative mechanism that allows a position to „breathe” after achieving a significant profit:

  1. After reaching Inp_NegBE_Trigger_Points (5,000 pts) profit → activates is_breakeven2_set = true
  2. If the position retraces to Inp_NegBE_Level_Points (e.g. −3,000 pts) → position is closed
  3. Active only when Hard BE has NOT yet been set

Rationale: the position achieved a large profit (5,000 pts), so the system „allows” it to retrace to −3,000 pts before closing it. This dramatically reduces the number of prematurely exited trends.

Log: "Position #123: Virtual Negative BE Activated." → "Position #123: Closed by Virtual Negative BE."

Dynamic Take Profit (TP Extension on Strong Trend)

When price approaches TP within Inp_E_PL_Trigger_Points:

  1. Checks the BB (using a separate, wider deviation of Inp_E_BB_TP_Deviation = 3.0)
  2. If price breaches the outer BB band (strong trend confirmed!) → TP is pushed further by Inp_E_TP_Extension_Points (500 pts)
  3. Can be extended multiple times — no limit on the number of extensions

Log: "Position #123: Dynamic TP Extended by 500 points!"

Dynamic Channel (Box Trading) — Price Tunnel

6. Dynamic Channel (Box Trading) — Price Tunnel

Restricts the trading zone to a dynamically defined price corridor.

Standard Box (Long-Term)

Updated every Inp_Channel_Update_Hours hours (default 6h):

  1. Records the current BID price as base_price
  2. g_Channel_Upper = base_price + Channel_Points_Up × _Point
  3. g_Channel_Lower = base_price - Channel_Points_Down × _Point
  4. Trading is only allowed when price is inside the channel

Default settings: Upper +20,000 pts, Lower −5,000 pts — an asymmetric channel assuming greater upside potential.

Log: "NEW STANDARD PRICE CHANNEL: Base: 2100.50 | Upper: 2300.50 | Lower: 2050.50"

Manual Box (Anti-Crash Protection)

Inp_ManualBox_Enable = true allows the trader to manually define absolute price boundaries:

  • Inp_ManualBox_Upper — upper boundary (price)
  • Inp_ManualBox_Lower — lower boundary (price)

Use case: the trader can manually define a tunnel before a major fundamental event or when operating in a specific market regime.

Channel Priority (IsPriceInChannel)

1. Muzzle Box (active during Impulse) — HIGHEST PRIORITY
2. Manual Box (if Inp_ManualBox_Enable = true)
3. Standard Dynamic Channel (if Inp_Channel_Enable = true)

Status displayed on the panel as g_Status_Channel.

Institutional Impulse + Muzzle Mode

5. Institutional Impulse + Muzzle Mode

One of the defining mechanisms of the system. It detects institutional impulses (sudden, violent moves generated by large capital) and immediately changes the system’s behaviour.

Impulse Detection

On every new bar on Inp_Impulse_TF (default M1):

  1. Calculates average range and average volume over the last Inp_Impulse_AvgPeriod (20) candles
  2. Fetches ATR
  3. Calculates velocity = |current_close - prev_close| / prev_close
  4. Impulse detected if candle range > Inp_Impulse_Min_Range_Points (50 pts) AND at least ONE of the following is true:
  • velocity > Inp_Impulse_Velocity (0.5% price change)
  • current_range > RangeMult × avg_range (2× average)
  • current_range > ATRMult × ATR (2× ATR)
  • current_volume > VolMult × avg_volume (1.5× average volume)

Log: "Institutional Impulse Detected! Activating MUZZLE MODE for 15 mins."

Muzzle Mode — How the System’s Characteristics Change

After an impulse is detected, the system enters Muzzle Mode:

ParameterNormal ModeDuring Impulse (Muzzle Mode)
Min. Smart DI candle body2 pts150 pts
CCI block levelInp_Block_CCI_Level (350)Inp_Muzzle_CCI_Block_Level (130)
SELL signalsAllowedBlocked if Channel_Down = 0
Price channelStandard Dynamic ChannelMuzzle Box (anchored at impulse price)

Key point: When Inp_Muzzle_Channel_Points_Down = 0, the system operates exclusively as BUY ONLY during an impulse — selling is completely blocked. This allows the system to ride the momentum after a breakout move.

Dynamic Muzzle Channel

At the moment an impulse is detected, the system saves the current BID price (g_Muzzle_BasePrice). All subsequent signals must fall within:

  • Upper: base_price + Muzzle_Channel_Points_Up
  • Lower: base_price - Muzzle_Channel_Points_Down (or -DBL_MAX when Down = 0)

Muzzle Mode Deactivation

Muzzle Mode expires only when ALL of the following conditions are met:

  1. Cooldown elapsed: (current_time - impulse_time) > Impulse_Cooldown_Mins × 60
  2. Market has calmed: current_range ≤ 1.5 × avg_range AND current_volume ≤ 1.5 × avg_vol
  3. A local peak or trough has formed: the previous candle has a higher high (peak) or lower low (trough) than its neighbours

Log: "Market calmed down. MUZZLE MODE deactivated."

Makro Matrix Risk — dynamiczna punktacja instytucjonalna

4. Makro Matrix Risk — dynamiczna punktacja instytucjonalna

This is the most unique feature of the system. Before every order, AHS consults 19 global assets, analysing each through 5 indicators — a total of 95 indicator handles running in parallel.

Skład Makro Matrix Risk

Tech Titans (≈60% of the pool):

AssetBase Weight
Apple (AAPL)8%
Microsoft (MSFT)8%
Nvidia (NVDA)8%
Amazon (AMZN)5%
Meta (META)5%
Alphabet (GOOGL)5%
Tesla (TSLA)4%
Broadcom (AVGO)4%
Costco (COST)3%
Netflix (NFLX)2%
PepsiCo (PEP)2%
Cisco (CSCO)2%
T-Mobile (TMUS)2%
Adobe (ADBE)1%
AMD1%

Global Macro (≈40% of the pool):

AssetBase WeightSpecial Role
Bitcoin (BTC)10%Risk-On barometer
Gold (GOLD)10%Inverse correlation — Risk-Off
EURUSD10%Dollar strength proxy (DXY)
AUDJPY10%Carry trade / risk appetite

Dynamic Weighting — What Sets This System Apart

Base weights are a starting point, not fixed values. For each asset, a multiplier is computed based on current indicators:

Indicators per asset (H1 timeframe):
  → MA50, MA200   (long-term trend)
  → RSI(14)       (momentum / overbought-oversold)
  → CCI(14)       (deviation from mean)
  → MFI(14)       (money flow)

Multiplier logic for BUY scoring:
  → Bullish trend (MA50 > MA200):          +0.5
  → Oversold (RSI<30 or CCI<-100):        +0.5
  → Overbought (RSI>70 or CCI>100):       -0.5
  → Money flowing in (MFI>50):            +0.2

Multiplier logic for SELL scoring:
  → Bearish trend (MA50 < MA200):          +0.5
  → Overbought (RSI>70 or CCI>100):       +0.5
  → Oversold (RSI<30 or CCI<-100):        -0.5
  → Money flowing out (MFI<50):           +0.2

Minimum multiplier = 0.1 (prevents negative weights).

Scoring Mechanism

effective_weight = base_weight × multiplier
max_pool        += effective_weight           // maximum possible score

// Does this asset confirm the direction?
if BUY:  price > MA50 → align_score += effective_weight
if SELL: price < MA50 → align_score += effective_weight

// GOLD is inverse (is_inverse=true):
// Bullish GOLD = Risk-Off = confirms SELL, not BUY

final_alignment = (align_score / max_pool) × 100%

Block condition: If final_alignment < Inp_Macro_Min_Alignment_Percent (default 70%) → order blocked.

Lazy Evaluation

The Macro Matrix is not computed on every tick. It is triggered exclusively when a strategy generates a signal. This dramatically reduces CPU usage. Log: "BUY Align: 82% (Pool: 145)" / "Block BUY: Macro Score".

When No Market Is Active

When all assets are inactive (no data, markets closed) → max_pool = 0 → filter bypassed, trading allowed. The system never blocks itself when global data is unavailable.

Adaptive Hybrid System - Multi-Core Strategy Engine -US100
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.