Advertisement IC Markets

Heat Maps of Your Performance by Day and Hour

Document your personal trading journey. Track daily equity curves, review winning and losing streaks, share trade screenshots, and get constructive feedback.
PTScalper
Site Admin
Posts: 7821
Joined: Mon Jul 20, 2026 1:28 pm

Re: Heat Maps of Your Performance by Day and Hour

Post by PTScalper »

2. MetaTrader 5 (MQL5) Implementation

In MQL5, we use the CTrade library for execution. The architecture remains the same: the state of the time window dictates the strictness of the stop modification.

Code: Select all

#include <Trade\Trade.mqh>
CTrade trade;

input double StandardTrailPips = 10.0;
input double AggressiveTrailPips = 3.0;

void OnTick()
{
    bool allowed = IsTradingAllowed();
    
    // Always manage open positions
    ManageTrailingStops(allowed);
    
    // Gatekeeper for new entries
    if(!allowed) return;
    
    // Entry logic...
}

void ManageTrailingStops(bool isTradingAllowed)
{
    double activeTrail = isTradingAllowed ? StandardTrailPips : AggressiveTrailPips;
    double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
    double trailDistance = activeTrail * 10 * point; // Assuming 5-digit broker

    for(int i = PositionsTotal() - 1; i >= 0; i--)
    {
        ulong ticket = PositionGetTicket(i);
        if(PositionGetString(POSITION_SYMBOL) != _Symbol) continue;
        
        double currentStop = PositionGetDouble(POSITION_SL);
        double currentTakeProfit = PositionGetDouble(POSITION_TP);
        long type = PositionGetInteger(POSITION_TYPE);
        
        if(type == POSITION_TYPE_BUY)
        {
            double currentBid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
            double newStop = currentBid - trailDistance;
            
            if(currentStop == 0 || newStop > currentStop)
            {
                trade.PositionModify(ticket, newStop, currentTakeProfit);
            }
        }
        else if(type == POSITION_TYPE_SELL)
        {
            double currentAsk = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
            double newStop = currentAsk + trailDistance;
            
            if(currentStop == 0 || newStop < currentStop)
            {
                trade.PositionModify(ticket, newStop, currentTakeProfit);
            }
        }
    }
}
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Recommended broker for automated trading & scalping IC Markets
PTScalper
Site Admin
Posts: 7821
Joined: Mon Jul 20, 2026 1:28 pm

Re: Heat Maps of Your Performance by Day and Hour

Post by PTScalper »

Critical Edge Cases for Scalpers

When tightening stops programmatically during low-liquidity periods, you must engineer around spread widening.

The Spread-Out Trap: On Raw ECN accounts, spreads during the midday chop might hover near 0.0 pips, but on Friday afternoons (or during the 23:59 server rollover), spreads can artificially widen by 2 to 5 pips as liquidity providers pull their quotes.

The Solution: If you set your AggressiveTrail to 2 pips, the widened spread alone will trigger your Stop Loss instantly, resulting in horrible slippage. Your aggressive trail distance must always be structurally larger than the maximum expected spread of that time block.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
PTScalper
Site Admin
Posts: 7821
Joined: Mon Jul 20, 2026 1:28 pm

Re: Heat Maps of Your Performance by Day and Hour

Post by PTScalper »

Instead of a fixed pip distance, an alternative approach for the Soft Close is a Fractal or Candle-Based Trail. Rather than trailing by 3 pips, you program the bot to trail the Stop Loss to the High/Low of the previous M5 or M15 candle once the lockout begins. This allows the trade to breathe technically while strictly preventing it from reversing the current micro-trend.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Heat Maps of Your Performance by Day and Hour

Post by Shadow Trader »

PTScalper's point about broker server time matters for the heat map itself, not only the lockout code. A broker on UTC+2 in winter and UTC+3 in summer labels 9am Lagos as 10:00 for half the year and 11:00 for the rest, splitting one London hour across two columns. Converting entries to your own clock first fixes it.

Sample size is worth checking with numbers. Say each trade's result has a standard deviation of about 1.2R, then a block of 16 trades has a standard error of 0.3R, and a cell showing +0.3R cannot be told apart from zero.

At 64 trades the error halves to 0.15R. That is the case for the three or four blocks Fairman described rather than hourly cells.

Another choice is whether a trade belongs to its entry hour or its exit hour. A position opened at 1:50pm and closed at 3:10pm Lagos lived through the New York open, and calling it a lunchtime trade hides that.

I would tag by entry for deciding when to trade and keep a second table by exit. Has anyone compared the two and found they point at different blocks?
FXS Prop Desk
Posts: 1689
Joined: Wed Oct 07, 2026 9:52 am

Re: Heat Maps of Your Performance by Day and Hour

Post by FXS Prop Desk »

With few trades per cell, a heat map can show patterns that are just noise. Grouping hours into blocks (for example two- or three-hour windows) and requiring a minimum number of trades per cell before drawing conclusions makes the map more reliable.

Updating the heat map every quarter shows whether patterns are stable or change over time.

Combining the heat map with the number of trades per cell, shown as a second table, makes it clear which colours are based on enough data.
FXS Official Team | The Idea Lab & Strategy
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Heat Maps of Your Performance by Day and Hour

Post by Shadow Trader »

FXS Prop Desk's minimum count per cell helps, but it throws the small cells away entirely. A softer option is to pull each cell toward the overall average, with the pull getting weaker as the trade count grows.

One simple version is adjusted R equals cell trades times cell R plus 10 times the overall R, divided by cell trades plus 10. Say the whole sample averages +0.1R and a Monday London open cell shows +0.9R from 4 trades, then the adjusted figure is about +0.33R.
img_13233_r2.png
img_13233_r2.png (153.77 KiB) Viewed 183 times
The made up map in the chart shows both versions side by side. A Friday overlap block at minus 0.3R over 40 trades barely moves, to minus 0.22R, so the real weak spot stays red while the lucky green cell fades.

The 10 is a judgement call, roughly how many trades you would want before trusting a cell on its own. Raising it makes the map more cautious, and lowering it lets small cells speak louder.

On updating every quarter, I would keep the old quarters in the map rather than restarting. A block that stays red across three quarters of accumulated trades is a far better reason to cut it than one quarter on its own.
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Re: Heat Maps of Your Performance by Day and Hour

Post by Shadow Trader »

Most traders log win rate, average win and average loss. Few log time of day, and that's a pity because it's often the most revealing breakdown.

Tag every trade with the hour it was opened, in a fixed timezone. After a couple of hundred trades, group by hour and look at average result per trade.

What often shows up:

- One or two hours make nearly all the profit.

- One or two hours quietly lose it back.

- A surprising number of trades happen in the lowest-quality windows, driven by boredom rather than setups.

Cutting the worst hour from the schedule can raise net results without changing the strategy at all. It's the closest thing to free money in a journal.

A word of caution: small samples lie. Fifty trades in an hour can be luck. A few hundred starts to mean something, and a few months of consistency means even more.

What does the best hour look like, and what does the worst hour cost?
Fairman
Posts: 6955
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

Re: Heat Maps of Your Performance by Day and Hour

Post by Fairman »

The advice to group hours into three blocks matters more than it sounds. When I first made a heat map with a cell per hour, I had about 250 trades spread over 5 days and 12 hours, so around four trades per cell. The colours looked dramatic and meant nothing.

With three blocks, say 07:00 to 10:00, 10:00 to 14:00 and 14:00 to 18:00 server time, I got roughly 80 trades per block, and the picture was clearer. The morning block averaged +0.18R, midday -0.03R and afternoon -0.12R. If I'd just trade the morning, and risk 0.5 percent per trade, then on a 10,000 dollar account that's about 50 dollars per trade at 0.18R expectancy, which is 9 dollars average per trade. The afternoon was costing me about 6 dollars a trade in expected terms.

You say patterns should hold across months before acting. I'd add that the reason has to make sense. If it's liquidity, fine, but if it's "Thursdays at 2pm", I'd treat it as noise.

Do you split by session blocks only, or also by day type, such as data days versus quiet days? And have you tried running the same map on a different pair?
It’s Fairman :geek:
Post Reply