Page 2 of 3

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:53 am
by PTScalper
Both of these approaches intentionally leave the Asian session flat, only rendering the tension gap the moment the London bell rings. You can easily extend either script to calculate the absolute point distance between the two variables and pass a sizing modifier to your Expert Advisor if the gap exceeds a specific ATR threshold.

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:54 am
by PTScalper
The core of an exponential money management algorithm in cAlgo involves isolating the NetProfit of an active baseline position, allocating a percentage of that profit as your new risk capital, and dynamically calculating NormalizeVolumeInUnits for the next order while moving existing stop losses to lock in the baseline.

In a Raw ECN environment, this requires a continuous loop of calculating the pip value against the floating profit, ensuring the reinvested volume scales up geometrically without ever exposing the initial account balance once the first threshold is crossed.

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:55 am
by PTScalper
Here is the C# cTrader Robot implementation that handles this risk-free scaling logic:

Code: Select all

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.EEuropeStandardTime, AccessRights = AccessRights.None)]
    public class ExponentialProfitScaler : Robot
    {
        [Parameter("Reinvestment Ratio (%)", DefaultValue = 50, MinValue = 10, MaxValue = 100)]
        public double ReinvestmentRatio { get; set; }

        [Parameter("Scale-in Step (Pips)", DefaultValue = 15, MinValue = 5)]
        public double ScaleInStep { get; set; }
        
        [Parameter("Stop Loss / Trailing (Pips)", DefaultValue = 15, MinValue = 5)]
        public double SlPips { get; set; }

        [Parameter("Strategy Label", DefaultValue = "ExpScaler")]
        public string TradeLabel { get; set; }

        protected override void OnTick()
        {
            var positions = Positions.FindAll(TradeLabel, SymbolName);
            
            if (positions.Length == 0) return; // Awaits manual or algorithmic baseline entry

            // Identify the most recent tier to measure distance
            var lastPosition = positions.OrderByDescending(p => p.EntryTime).First();
            
            // Calculate total floating profit across the sequence
            double totalFloatingProfit = positions.Sum(p => p.NetProfit);

            if (totalFloatingProfit > 0)
            {
                bool isLong = lastPosition.TradeType == TradeType.Buy;
                
                double distanceInPips = isLong 
                    ? (Symbol.Bid - lastPosition.EntryPrice) / Symbol.PipSize 
                    : (lastPosition.EntryPrice - Symbol.Ask) / Symbol.PipSize;

                // Trigger scale-in when price moves the required step distance
                if (distanceInPips >= ScaleInStep)
                {
                    ExecuteScaleIn(totalFloatingProfit, lastPosition.TradeType);
                }
            }
        }

        private void ExecuteScaleIn(double floatingProfit, TradeType tradeType)
        {
            // 1. Determine Risk Capital from Floating Gains
            double availableRiskCapital = floatingProfit * (ReinvestmentRatio / 100.0);

            // 2. Convert Capital to Volume based on Stop Loss risk
            // Volume = Risk / (StopLossPips * PipValue)
            double rawVolume = availableRiskCapital / (SlPips * Symbol.PipValue);
            
            // Normalize volume to broker requirements (e.g., micro lots)
            double normalizedVolume = Symbol.NormalizeVolumeInUnits(rawVolume, RoundingMode.Down);

            if (normalizedVolume >= Symbol.VolumeInUnitsMin)
            {
                // 3. Protect existing capital before opening new exposure
                UpdateTrailingStops(SlPips);

                // 4. Execute the compounded tier
                ExecuteMarketOrder(tradeType, SymbolName, normalizedVolume, TradeLabel, SlPips, null, "Scale In");
            }
        }

        private void UpdateTrailingStops(double trailingPips)
        {
            var positions = Positions.FindAll(TradeLabel, SymbolName);
            
            foreach (var position in positions)
            {
                double newStopLoss = position.TradeType == TradeType.Buy 
                    ? Symbol.Bid - (trailingPips * Symbol.PipSize)
                    : Symbol.Ask + (trailingPips * Symbol.PipSize);

                // Only move stop loss deeper into profit (never widen it)
                if (!position.StopLoss.HasValue || 
                    (position.TradeType == TradeType.Buy && newStopLoss > position.StopLoss.Value) ||
                    (position.TradeType == TradeType.Sell && newStopLoss < position.StopLoss.Value))
                {
                    ModifyPositionAsync(position, newStopLoss, position.TakeProfit);
                }
            }
        }
    }
}

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:55 am
by PTScalper
Mechanical Breakdown

The Reinvestment Ratio: The availableRiskCapital calculation extracts a strict percentage of the current NetProfit across the entire sequence. Keeping this under 100% (e.g., 50%) ensures that even if the trailing stop is hit via sudden slippage, the sequence closes net-positive.

Geometric Volume Normalization: rawVolume = availableRiskCapital / (SlPips * Symbol.PipValue) converts unrealized account currency into standard lots. Because availableRiskCapital grows as the trend extends, the returned normalizedVolume becomes exponentially larger at each subsequent ScaleInStep.

Capital Protection Barrier: The script mandates that UpdateTrailingStops executes before ExecuteMarketOrder. As the new larger position is injected into the market, the older baseline positions immediately move their stops to lock in the exact profit required to fund the new risk.

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:57 am
by PTScalper
When trading highly liquid instruments like spot forex or XAUUSD on a Raw ECN feed, spreads remain ultra-tight under normal conditions but can violently widen to 30+ pips during macroeconomic news releases or the midnight broker rollover. To prevent the algorithm from compounding your exposure during these liquidity vacuums, introduce a MaxSpreadPips parameter and validate the current spread before submitting the next market order.

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:57 am
by PTScalper
First, add the user-defined parameter at the top of your class:

Code: Select all

[Parameter("Max Allowed Spread (Pips)", DefaultValue = 1.5, MinValue = 0.1, Group = "Risk Management")]
public double MaxSpreadPips { get; set; }

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:57 am
by PTScalper
Next, update your OnTick() method to dynamically check the bid/ask gap right before triggering the ExecuteScaleIn method:

Code: Select all

protected override void OnTick()
        {
            var positions = Positions.FindAll(TradeLabel, SymbolName);
            
            if (positions.Length == 0) return;

            var lastPosition = positions.OrderByDescending(p => p.EntryTime).First();
            double totalFloatingProfit = positions.Sum(p => p.NetProfit);

            if (totalFloatingProfit > 0)
            {
                bool isLong = lastPosition.TradeType == TradeType.Buy;
                
                double distanceInPips = isLong 
                    ? (Symbol.Bid - lastPosition.EntryPrice) / Symbol.PipSize 
                    : (lastPosition.EntryPrice - Symbol.Ask) / Symbol.PipSize;

                if (distanceInPips >= ScaleInStep)
                {
                    // 1. Calculate current live spread
                    double currentSpreadPips = Symbol.Spread / Symbol.PipSize;
                    
                    // 2. Validate against risk threshold
                    if (currentSpreadPips > MaxSpreadPips)
                    {
                        Print("Scale-in paused. Spread widened to {0} pips.", Math.Round(currentSpreadPips, 1));
                        return; // Halt execution until liquidity returns
                    }

                    ExecuteScaleIn(totalFloatingProfit, lastPosition.TradeType);
                }
            }
        }

Re: When the daily open and the London open disagree

Posted: Sat Oct 17, 2026 8:58 am
by PTScalper
By dividing Symbol.Spread by Symbol.PipSize, the API converts the raw ask/bid distance into standard pips, regardless of the instrument's digit structure.

Because the return; statement acts as a hard stop inside OnTick(), the bot skips scaling entirely while the spread breaches the limit. However, because OnTick() evaluates on every single price update, the scale-in sequence will automatically trigger the exact millisecond the spread compresses back down to a normal level and satisfies your threshold limit.

Re: When the daily open and the London open disagree

Posted: Sat Oct 31, 2026 2:11 pm
by Fairman
I'd look at where price is relative to both levels at the start of the London session. If price is above both, there's no disagreement in practice, and both suggest a bullish lean. The disagreement only matters when price sits between them. In that case, the range between the two opens can act like a small no man's land. Breaks out of it in either direction are often more meaningful than moves within it. It's a simple way to turn a conflict into a range you can trade around. It also gives a natural place for a stop, just on the other side of the range.

Re: When the daily open and the London open disagree

Posted: Sat Oct 31, 2026 9:17 pm
by FXS Prop Desk
The disagreement between the two opens gives a useful lens on the London session. When Asia has already moved price far from the daily open, London starts with an imbalance that someone has to resolve. Either London continues the Asian move, or it pulls price back toward the daily open. Tracking which of the two happens, together with the size of the Asian move, could turn this into a simple rule. Large Asian moves on no news may be more likely to be reversed than moves driven by real data.