Page 2 of 2

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Mon Sep 14, 2026 4:58 pm
by PTScalper
1. cAlgo (C#)

In your OnTick method, replace the standard ClosePosition(position) call with this dedicated method. It queries the closed position from the History pool to guarantee it logs the true server-acknowledged fill price.

Code: Select all

private void ExecuteMarketAbort(Position position, string abortReason)
{
    // 1. Snapshot the expected price before the network call
    double expectedPrice = position.TradeType == TradeType.Buy ? Symbol.Bid : Symbol.Ask;
    
    // 2. Execute the close synchronously
    TradeResult result = ClosePosition(position);

    if (result.IsSuccessful)
    {
        // 3. Fetch the actual execution record from history
        var closedTrade = History.FindLast(position.Label, position.SymbolName);
        if (closedTrade != null)
        {
            double actualPrice = closedTrade.ClosingPrice;
            
            // Calculate slippage in Pips
            double slippagePips = position.TradeType == TradeType.Buy 
                ? (expectedPrice - actualPrice) / Symbol.PipSize 
                : (actualPrice - expectedPrice) / Symbol.PipSize;

            Print($"[ABORT: {abortReason}] Expected: {expectedPrice:F5} | Filled: {actualPrice:F5} | Slippage: {slippagePips:F1} pips");
        }
    }
    else
    {
        Print($"[ABORT FAILED] {abortReason} - Error: {result.Error}");
    }
}

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Mon Sep 14, 2026 4:58 pm
by PTScalper
2. MQL5

Using the standard library CTrade, the execution properties are immediately available in the ResultPrice() method after the macro completes.

Code: Select all

void ExecuteMarketAbort(ulong ticket, string abortReason)
{
    if (PositionSelectByTicket(ticket))
    {
        long type = PositionGetInteger(POSITION_TYPE);
        
        // Snapshot expected price
        double expectedPrice = (type == POSITION_TYPE_BUY) ? SymbolInfoDouble(_Symbol, SYMBOL_BID) : SymbolInfoDouble(_Symbol, SYMBOL_ASK);
        
        // Execute market close
        if (trade.PositionClose(ticket))
        {
            double actualPrice = trade.ResultPrice();
            double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
            
            // Calculate slippage in Points
            double slippagePoints = (type == POSITION_TYPE_BUY) ? 
                                    (expectedPrice - actualPrice) / point : 
                                    (actualPrice - expectedPrice) / point;
                                    
            PrintFormat("[ABORT: %s] Expected: %.5f | Filled: %.5f | Slippage: %.0f points", 
                        abortReason, expectedPrice, actualPrice, slippagePoints);
        }
        else
        {
            PrintFormat("[ABORT FAILED] %s - Error: %d", abortReason, GetLastError());
        }
    }
}

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Mon Sep 14, 2026 4:59 pm
by PTScalper
3. MQL4

MQL4 is legacy, so you have to close the order, verify the boolean response, and then re-select the ticket from the MODE_HISTORY pool to get the definitive OrderClosePrice().

Code: Select all

void ExecuteMarketAbort(int ticket, string abortReason)
{
    if (OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
    {
        int type = OrderType();
        double lots = OrderLots();
        
        // Snapshot expected price
        double expectedPrice = (type == OP_BUY) ? Bid : Ask;
        
        // Execute close with 0 allowed slippage parameter (forces market execution at whatever liquidity is available)
        if (OrderClose(ticket, lots, expectedPrice, 0, clrRed))
        {
            // Re-select from the history pool to get the true server fill
            if (OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY))
            {
                double actualPrice = OrderClosePrice();
                
                // Calculate slippage in Points
                double slippagePoints = (type == OP_BUY) ? 
                                        (expectedPrice - actualPrice) / Point : 
                                        (actualPrice - expectedPrice) / Point;
                                        
                PrintFormat("[ABORT: %s] Expected: %.5f | Filled: %.5f | Slippage: %.0f points", 
                            abortReason, expectedPrice, actualPrice, slippagePoints);
            }
        }
        else
        {
            PrintFormat("[ABORT FAILED] %s - Error: %d", abortReason, GetLastError());
        }
    }
}

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Mon Sep 14, 2026 4:59 pm
by PTScalper
By logging this to the platform's journal, you can export the logs to CSV at the end of the week. If you notice a specific pair consistently slipping you 2+ pips only when the Z-score volume triggers the abort, you know the market makers on that instrument aggressively pull their quotes the second volume drops, and you can stop scalping it during quiet hours.

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Mon Sep 14, 2026 5:17 pm
by LondonScalper
PTScalper wrote:Holding through noise: The tape is still active... The market left: The tape goes lumpy. You see gaps between prints.
That’s the clean split — velocity and participation, not the candle shape.

If I entered for immediate continuation and the book goes lumpy, the trade is already wrong even if the hard stop is still three points away. Chart “validity” without prints is just hope with a stop attached.

Desk detail on Cable and Gold: I watch the time between meaningful prints on the top of book, not just volume bars. If two-way flow collapses into one-sided drift with gaps, I abort at market and log it as premise dead — not as a stop hit. That keeps the blotter honest about why I left.

On the later points in this thread about not waiting for the stop to “prove” the abort: agreed. A clean abort is a decision, not a fill.

Rule: if the reason you entered has left the tape, you leave with it. Do you abort on the first lumpy gap, or do you need two consecutive thin windows before you scratch?

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Thu Sep 24, 2026 5:41 am
by PropScalpDesk
PTScalper wrote:The MQL4 Legacy Adapter (Order-Centric) MT4 requires looping through the global order pool utilizing OrderSelect(). We also rely on MarketInfo() and the built-in iVolume() array instead of MT5's copy functions.
A clean abort mid-trade is never a panic response; it is a pre-defined tactical retreat. The parameters must be set in stone before the order is ever submitted: if the spread suddenly explodes into toxic volatility, or if the underlying structural thesis breaks, you flatten the position immediately. There is absolutely no room to hold out for a miraculous "hope candle" to bail you out of a broken setup. Executing a ruthless, emotionless abort is just as critical a skill as finding the optimal entry.

I actively train for this scenario. I purposefully take bad fills on a demo account just to practice slamming the kill switch. The goal is to make the reaction entirely mechanical. When real capital is on the line and the tape gets erratic, hitting the flat button must be pure muscle memory, completely devoid of hesitation, rationalization, or ego.

You have to ask yourself: what is the exact, undeniable condition that forces your abort without a single second of internal debate?

This is precisely why I physically write down my hard walk-away conditions before the London open. Once the bell rings and the order book starts flashing, the human brain desperately wants to rationalize bad positioning. Documenting the rules in advance ensures the boundary is objectively defined and cannot be renegotiated mid-tape when adrenaline is running high.

Furthermore, complexity is the enemy of sharp execution. If the trade idea requires a fundamental story or technical justification longer than a single, punchy sentence, it is too convoluted. The capital is preserved, the setup is scrapped, and the idea waits for a clearer window.

Working within these strict parameters is why the funded trailing drawdown (DD) is so valuable. I treat the trailing DD as an unforgiving, external referee. It strips away any illusion of control you might feel when tilt sets in, stepping in to keep the desk strictly honest and entirely grounded in reality.

To anchor this discipline, I always refer back to a core topic note from my tracking sheet for t=12347: keep your risk parameters completely unchanged until the sample data dictates otherwise. You never size up on a gut feeling or a hot streak; you adjust your exposure only when a statistically significant block of trades mathematically proves you have the edge to justify it.

Re: What a clean abort looks like mid-trade when the tape goes thin

Posted: Thu Sep 24, 2026 12:48 pm
by LondonNewsTrader
PTScalper wrote:The MQL4 Legacy Adapter (Order-Centric) MT4 requires looping through the global order pool utilizing OrderSelect(). We also rely on MarketInfo() and the built-in iVolume() array instead of MT5's copy functions.
The three abort triggers match the opening post well, but one of them will misfire as written, and the close itself can fail at the worst moment.

If GetMQL4TickVolZScore compares the current bar's iVolume with the last 20, it's scoring an incomplete bar. Ten seconds into a new M1 candle, tick volume is naturally tiny compared with finished bars, so the z-score dips below −1.5 and 'tape is dead' fires at the start of almost every minute. Using the last closed bar, or scaling the current count by the elapsed fraction of the bar, fixes that.

OrderClose uses a fixed deviation of 3 points and doesn't retry. When the spread is spiking, one of the reasons to abort, a 0.3-pip tolerance is likely to be requoted, the close fails, the cooling timer never starts, and the EA tries again on the next tick with stale prices. I'd add RefreshRates() before reading Bid/Ask, a wider deviation for abort closes, and a GetLastError() check so failed closes get logged.

A 1.0-pip spread ceiling is a good EURUSD number, but it will abort every GBPJPY or gold trade instantly. A per-symbol input, or a multiple of the median spread, would make it portable.