EURUSD journal: how cost tags changed my behavior
-
LondonScalper
- Posts: 965
- Joined: Sat Sep 05, 2026 7:54 am
EURUSD journal: how cost tags changed my behavior
EURUSD journal: how cost tags changed my behaviour.
I used to review cable on win rate and R. Then I tagged each ticket with round-trip cost bucket (cheap / normal / expensive) at click. Pattern: my "okay" setups during expensive open minutes had negative expectancy after costs, while the same pattern mid-morning was fine.
Behaviour change
Harder spread filter in the first fifteen minutes. More limits. Fewer tickets that needed perfect fills to work. Win rate dipped slightly; net R improved. The tag made the cost visible instead of a vague complaint about the broker.
I still keep setup tags. Cost tags sit beside them so I do not confuse a dead edge with a timing problem.
If you journal EURUSD, do you tag costs separately -- and did it change when you allow entries?
I apply the same cost tags to losers and winners. Expensive winners still teach timing. If a setup only works when the spread is gift-wrapped, it is not robust for the open. Cable taught me that faster than any ebook on price action.
I used to review cable on win rate and R. Then I tagged each ticket with round-trip cost bucket (cheap / normal / expensive) at click. Pattern: my "okay" setups during expensive open minutes had negative expectancy after costs, while the same pattern mid-morning was fine.
Behaviour change
Harder spread filter in the first fifteen minutes. More limits. Fewer tickets that needed perfect fills to work. Win rate dipped slightly; net R improved. The tag made the cost visible instead of a vague complaint about the broker.
I still keep setup tags. Cost tags sit beside them so I do not confuse a dead edge with a timing problem.
If you journal EURUSD, do you tag costs separately -- and did it change when you allow entries?
I apply the same cost tags to losers and winners. Expensive winners still teach timing. If a setup only works when the spread is gift-wrapped, it is not robust for the open. Cable taught me that faster than any ebook on price action.
Re: EURUSD journal: how cost tags changed my behavior
Hi LondonScalper,LondonScalper wrote: Mon Sep 14, 2026 10:47 pm EURUSD journal: how cost tags changed my behaviour.
I used to review cable on win rate and R. Then I tagged each ticket with round-trip cost bucket (cheap / normal / expensive) at click. Pattern: my "okay" setups during expensive open minutes had negative expectancy after costs, while the same pattern mid-morning was fine.
Behaviour change
Harder spread filter in the first fifteen minutes. More limits. Fewer tickets that needed perfect fills to work. Win rate dipped slightly; net R improved. The tag made the cost visible instead of a vague complaint about the broker.
I still keep setup tags. Cost tags sit beside them so I do not confuse a dead edge with a timing problem.
If you journal EURUSD, do you tag costs separately -- and did it change when you allow entries?
I apply the same cost tags to losers and winners. Expensive winners still teach timing. If a setup only works when the spread is gift-wrapped, it is not robust for the open. Cable taught me that faster than any ebook on price action.
This is a profound journal entry. You have successfully isolated a strategy's theoretical edge from the market's microstructure—a leap that separates professional algorithmic thinkers from retail traders. Most traders spend years tweaking indicators or entry triggers because they misdiagnose a "dead edge," when in reality, they just have a localized execution problem.
Here is an extended breakdown of why this behavioral shift is so critical, followed by a Pine Script implementation to automate this cost-tagging visualization on your charts.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
The Microstructure Reality of "Expensive" Minutes
Your observation about the first fifteen minutes of the open perfectly illustrates how market makers manage toxic flow. During the London or New York open, order books are momentarily thinned out. The spread widens not just because of volume, but because liquidity providers are protecting themselves against sudden, informed directional sweeps.
When you tag an "okay" setup during these minutes as expensive, you are quantifying the exact moment your localized expectancy goes negative. If your average winner is 2R and your stop is tight (as is typical in price action scalping), a spread that expands by even 0.8 to 1.5 pips at the open can consume 10-20% of your initial risk allocation. That mathematically destroys marginal setups.
Your observation about the first fifteen minutes of the open perfectly illustrates how market makers manage toxic flow. During the London or New York open, order books are momentarily thinned out. The spread widens not just because of volume, but because liquidity providers are protecting themselves against sudden, informed directional sweeps.
When you tag an "okay" setup during these minutes as expensive, you are quantifying the exact moment your localized expectancy goes negative. If your average winner is 2R and your stop is tight (as is typical in price action scalping), a spread that expands by even 0.8 to 1.5 pips at the open can consume 10-20% of your initial risk allocation. That mathematically destroys marginal setups.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
How Cost Tagging Changes Execution Behavior
To answer your question: Yes, separating the cost tag from the setup tag is a game-changer. When you journal EURUSD (or Cable) this way, the behavioral changes you noted are exactly what should happen:
The Shift to Limit Orders: By recognizing expensive environments, you intuitively stop paying the "taker fee" (crossing the spread with market orders) and start earning the "maker premium" (resting limit orders). This reduces the frequency of fills, but drastically increases the quality of the ones you get.
Embracing a Lower Win Rate for a Higher Net R: An "okay" setup at 9:30 AM with a 0.2 pip spread might have a positive expectancy. That exact same setup at 8:02 AM with a 1.2 pip spread has a negative expectancy. By passing on the open, your win rate might dip because you miss a few runners, but your Net R climbs because you stop absorbing the heavy transactional drag of stopped-out wide-spread entries.
The Gift-Wrapped Spread: As you noted, if a strategy only works when the spread is tiny, it's not a robust strategy—it's just a spread arbitrage that relies on perfect conditions. Tagging expensive winners is brilliant because it proves the setup's underlying momentum was strong enough to overcome a terrible fill.
To answer your question: Yes, separating the cost tag from the setup tag is a game-changer. When you journal EURUSD (or Cable) this way, the behavioral changes you noted are exactly what should happen:
The Shift to Limit Orders: By recognizing expensive environments, you intuitively stop paying the "taker fee" (crossing the spread with market orders) and start earning the "maker premium" (resting limit orders). This reduces the frequency of fills, but drastically increases the quality of the ones you get.
Embracing a Lower Win Rate for a Higher Net R: An "okay" setup at 9:30 AM with a 0.2 pip spread might have a positive expectancy. That exact same setup at 8:02 AM with a 1.2 pip spread has a negative expectancy. By passing on the open, your win rate might dip because you miss a few runners, but your Net R climbs because you stop absorbing the heavy transactional drag of stopped-out wide-spread entries.
The Gift-Wrapped Spread: As you noted, if a strategy only works when the spread is tiny, it's not a robust strategy—it's just a spread arbitrage that relies on perfect conditions. Tagging expensive winners is brilliant because it proves the setup's underlying momentum was strong enough to overcome a terrible fill.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
Below is a Pine Script designed to overlay this exact journaling philosophy onto your charts.
Pine Script: Microstructure Cost Filter & Setup Tagger
Because TradingView does not store historical, tick-by-tick spread data for backtesting, the most accurate proxy for "Expensive" vs. "Normal" cost environments is time-of-day clustering and localized volatility.
This script highlights the "Expensive" opening windows you mentioned (first 15 minutes of London and NY). It then detects a basic price action setup (an engulfing bar, as a placeholder for your actual trigger) and automatically tags it on the chart with your cost buckets.
Pine Script: Microstructure Cost Filter & Setup Tagger
Because TradingView does not store historical, tick-by-tick spread data for backtesting, the most accurate proxy for "Expensive" vs. "Normal" cost environments is time-of-day clustering and localized volatility.
This script highlights the "Expensive" opening windows you mentioned (first 15 minutes of London and NY). It then detects a basic price action setup (an engulfing bar, as a placeholder for your actual trigger) and automatically tags it on the chart with your cost buckets.
Code: Select all
//@version=5
indicator("Execution Cost Journal & Tagger", overlay=true, max_labels_count=50)
// =========================================================================
// INPUTS & COST ENVIRONMENTS
// =========================================================================
grp_time = "High-Cost Windows (Exchange Time)"
lon_open_str = input.session("0800-0815", title="London Open Window", group=grp_time)
ny_open_str = input.session("1300-1315", title="NY Open Window", group=grp_time)
session_tz = input.string("America/New_York", title="Timezone", group=grp_time)
// Determine if current bar falls inside the "Expensive" open minutes
in_lon_open = not na(time(timeframe.period, lon_open_str, session_tz))
in_ny_open = not na(time(timeframe.period, ny_open_str, session_tz))
// Cost Tag Logic
bool is_expensive = in_lon_open or in_ny_open
string cost_tag = is_expensive ? "EXPENSIVE\n(Limit Only)" : "NORMAL\n(Market OK)"
color cost_color = is_expensive ? color.new(color.red, 20) : color.new(color.green, 20)
// Visualize the Expensive environments on the chart background
bgcolor(is_expensive ? color.new(color.red, 92) : na, title="Expensive Cost Window")
// =========================================================================
// PROXY PRICE ACTION SETUP (Replace with your actual edge)
// =========================================================================
// Example: Bullish and Bearish Engulfing Candles
bull_engulf = close > open and close[1] < open[1] and close > open[1] and open < close[1]
bear_engulf = close < open and close[1] > open[1] and close < open[1] and open > close[1]
// =========================================================================
// CHART TAGGING (Replicating the Journal)
// =========================================================================
if bull_engulf
label.new(
x = bar_index,
y = low - ta.tr,
text = "Bull Setup\nCost: " + cost_tag,
color = cost_color,
textcolor = color.white,
style = label.style_label_up,
size = size.small
)
if bear_engulf
label.new(
x = bar_index,
y = high + ta.tr,
text = "Bear Setup\nCost: " + cost_tag,
color = cost_color,
textcolor = color.white,
style = label.style_label_down,
size = size.small
)
// =========================================================================
// LIVE SPREAD TRACKER (For Real-Time Execution Only)
// =========================================================================
// While historical spread isn't available, we can display real-time spread
// in a data window/table to help you make decisions at the hard right edge.
var table cost_table = table.new(position.top_right, 2, 2, border_width = 1)
if barstate.islast
// Calculate live spread in points/pips
float live_spread = (syminfo.mintick * 10) // Simplified proxy if ask/bid not available via broker feed in TV
table.cell(cost_table, 0, 0, "Current Phase:", text_color=color.white, bgcolor=color.gray)
table.cell(cost_table, 1, 0, is_expensive ? "EXPENSIVE" : "NORMAL", text_color=color.white, bgcolor=cost_color)Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
How to use this workflow going forward:
Replace the proxy: Swap the bull_engulf and bear_engulf variables in the script with the mathematical logic for your actual price action setups or liquidity sweeps.
Review your historical tags: Scroll back through your charts. You will visually see clusters of red "EXPENSIVE" tags during the opening 15 minutes.
Filter integration: If you eventually port this into a fully automated cAlgo or MQL5 script, you can use these exact time/spread buckets to automatically route orders (e.g., if (Cost == Expensive) { sendLimitOrder(); } else { sendMarketOrder(); }).
By treating the cost of execution as an independent variable from the setup's quality, you ensure you never accidentally throw away a profitable strategy just because you were executing it at the wrong time of day.
Replace the proxy: Swap the bull_engulf and bear_engulf variables in the script with the mathematical logic for your actual price action setups or liquidity sweeps.
Review your historical tags: Scroll back through your charts. You will visually see clusters of red "EXPENSIVE" tags during the opening 15 minutes.
Filter integration: If you eventually port this into a fully automated cAlgo or MQL5 script, you can use these exact time/spread buckets to automatically route orders (e.g., if (Cost == Expensive) { sendLimitOrder(); } else { sendMarketOrder(); }).
By treating the cost of execution as an independent variable from the setup's quality, you ensure you never accidentally throw away a profitable strategy just because you were executing it at the wrong time of day.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
MQL4 Implementation
Save this file as an Indicator in MetaEditor (MQL4/Indicators/CostJournalTagger.mq4).
Unlike TradingView, MT4 has direct access to live broker tick spreads via MarketInfo(). This indicator tracks live spread and high-friction opening windows, plots an on-chart HUD, and tags setup candles with execution cost ratings.
Save this file as an Indicator in MetaEditor (MQL4/Indicators/CostJournalTagger.mq4).
Unlike TradingView, MT4 has direct access to live broker tick spreads via MarketInfo(). This indicator tracks live spread and high-friction opening windows, plots an on-chart HUD, and tags setup candles with execution cost ratings.
Code: Select all
//+------------------------------------------------------------------+
//| CostJournalTagger.mq4 |
//| EURUSD Microstructure Cost Tagger |
//+------------------------------------------------------------------+
#property copyright "Execution Journal"
#property link ""
#property version "1.00"
#property strict
#property indicator_chart_window
//--- Input Parameters
input string InpSection1 = "=== SPREAD THRESHOLDS (PIPS) ===";
input double InpCheapSpreadPips = 0.4; // Cheap spread ceiling
input double InpExpensiveSpreadPips = 1.1; // Expensive spread floor
input string InpSection2 = "=== EXPENSIVE TIME WINDOWS (BROKER TIME) ===";
input bool InpUseTimeFilter = true; // Flag first 15 mins of sessions as Expensive
input int InpLonOpenHour = 8; // London Open Hour
input int InpLonOpenMinStart = 0; // London Open Start Minute
input int InpLonOpenMinEnd = 15; // London Open End Minute
input int InpNYOpenHour = 13; // NY Open Hour
input int InpNYOpenMinStart = 0; // NY Open Start Minute
input int InpNYOpenMinEnd = 15; // NY Open End Minute
input string InpSection3 = "=== VISUAL SETTINGS ===";
input color InpColorCheap = clrLimeGreen;
input color InpColorNormal = clrDodgerBlue;
input color InpColorExpensive = clrCrimson;
input string InpPrefix = "CJ_"; // Object Prefix
//--- Global Variables
double g_pipPoint = 0.0001;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
int digits = (int)MarketInfo(_Symbol, MODE_DIGITS);
g_pipPoint = (digits == 3 || digits == 5) ? Point * 10.0 : Point;
CreateDashboard();
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectsDeleteAll(0, InpPrefix);
}
//+------------------------------------------------------------------+
//| Helper: Classify execution cost bucket |
//+------------------------------------------------------------------+
void EvaluateCost(datetime barTime, double spreadPips, string &outTag, color &outColor, bool &outLimitOnly)
{
bool isExpensiveTime = false;
if(InpUseTimeFilter)
{
MqlDateTime tm;
TimeToStruct(barTime, tm);
bool isLondonOpen = (tm.hour == InpLonOpenHour && tm.min >= InpLonOpenMinStart && tm.min < InpLonOpenMinEnd);
bool isNYOpen = (tm.hour == InpNYOpenHour && tm.min >= InpNYOpenMinStart && tm.min < InpNYOpenMinEnd);
if(isLondonOpen || isNYOpen)
isExpensiveTime = true;
}
if(spreadPips >= InpExpensiveSpreadPips || isExpensiveTime)
{
outTag = "EXPENSIVE";
outColor = InpColorExpensive;
outLimitOnly = true;
}
else if(spreadPips <= InpCheapSpreadPips)
{
outTag = "CHEAP";
outColor = InpColorCheap;
outLimitOnly = false;
}
else
{
outTag = "NORMAL";
outColor = InpColorNormal;
outLimitOnly = false;
}
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
if(rates_total < 3) return(0);
// 1. Update Live HUD
double currentSpreadPips = (Ask - Bid) / g_pipPoint;
string liveTag = "";
color liveColor = clrWhite;
bool liveLimitOnly = false;
EvaluateCost(TimeCurrent(), currentSpreadPips, liveTag, liveColor, liveLimitOnly);
UpdateDashboard(currentSpreadPips, liveTag, liveColor, liveLimitOnly);
// 2. Process Setup Tagging on Closed Bars
int limit = rates_total - prev_calculated;
if(limit > rates_total - 2) limit = rates_total - 2;
for(int i = limit; i >= 1; i--)
{
// Bar classification based on historical spread array if available, else current
double barSpreadPips = (spread[i] > 0) ? (spread[i] * Point / g_pipPoint) : currentSpreadPips;
string tag = "";
color tagColor = clrWhite;
bool limitOnly = false;
EvaluateCost(time[i], barSpreadPips, tag, tagColor, limitOnly);
// Replace this condition with your specific entry trigger / sweep logic
bool bullEngulf = (close[i] > open[i] && close[i+1] < open[i+1] && close[i] > open[i+1] && open[i] < close[i+1]);
bool bearEngulf = (close[i] < open[i] && close[i+1] > open[i+1] && close[i] < open[i+1] && open[i] > close[i+1]);
string objName = InpPrefix + "Tag_" + TimeToString(time[i]);
if(bullEngulf && ObjectFind(0, objName) < 0)
{
string text = StringFormat("[BULL] %s | %s", tag, limitOnly ? "LIMIT ONLY" : "MARKET OK");
CreateChartLabel(objName, time[i], low[i] - (10 * Point), text, tagColor, ANCHOR_TOP);
}
else if(bearEngulf && ObjectFind(0, objName) < 0)
{
string text = StringFormat("[BEAR] %s | %s", tag, limitOnly ? "LIMIT ONLY" : "MARKET OK");
CreateChartLabel(objName, time[i], high[i] + (10 * Point), text, tagColor, ANCHOR_BOTTOM);
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
//| Dashboard UI Helpers |
//+------------------------------------------------------------------+
void CreateDashboard()
{
string name = InpPrefix + "HUD";
if(ObjectFind(0, name) < 0)
{
ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, 25);
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 10);
ObjectSetString(0, name, OBJPROP_FONT, "Consolas");
}
}
void UpdateDashboard(double spreadPips, string tag, color tagColor, bool limitOnly)
{
string name = InpPrefix + "HUD";
string text = StringFormat("Spread: %.1f pips | Cost: %s (%s)",
spreadPips, tag, limitOnly ? "LIMIT REQUIRED" : "MARKET OK");
ObjectSetString(0, name, OBJPROP_TEXT, text);
ObjectSetInteger(0, name, OBJPROP_COLOR, tagColor);
}
void CreateChartLabel(string name, datetime t, double price, string text, color clr, ENUM_ANCHOR_POINT anchor)
{
ObjectCreate(0, name, OBJ_TEXT, 0, t, price);
ObjectSetString(0, name, OBJPROP_TEXT, text);
ObjectSetString(0, name, OBJPROP_FONT, "Arial Bold");
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(0, name, OBJPROP_COLOR, clr);
ObjectSetInteger(0, name, OBJPROP_ANCHOR, anchor);
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
MQL5 Implementation
Save this file as an Indicator in MetaEditor (MQL5/Indicators/CostJournalTagger.mq5).
MQL5 directly provides SYMBOL_SPREAD, SYMBOL_ASK, and SYMBOL_BID, and processes series arrays forwards by default (so indices run from 0 to rates_total - 1).
Save this file as an Indicator in MetaEditor (MQL5/Indicators/CostJournalTagger.mq5).
MQL5 directly provides SYMBOL_SPREAD, SYMBOL_ASK, and SYMBOL_BID, and processes series arrays forwards by default (so indices run from 0 to rates_total - 1).
Code: Select all
//+------------------------------------------------------------------+
//| CostJournalTagger.mq5 |
//| EURUSD Microstructure Cost Tagger |
//+------------------------------------------------------------------+
#property copyright "Execution Journal"
#property link ""
#property version "1.00"
#property indicator_chart_window
#property indicator_plots 0
//--- Input Parameters
input group "=== SPREAD THRESHOLDS (PIPS) ==="
input double InpCheapSpreadPips = 0.4; // Cheap spread ceiling
input double InpExpensiveSpreadPips = 1.1; // Expensive spread floor
input group "=== EXPENSIVE TIME WINDOWS (BROKER TIME) ==="
input bool InpUseTimeFilter = true; // Flag first 15 mins of sessions as Expensive
input int InpLonOpenHour = 8; // London Open Hour
input int InpLonOpenMinStart = 0; // London Open Start Minute
input int InpLonOpenMinEnd = 15; // London Open End Minute
input int InpNYOpenHour = 13; // NY Open Hour
input int InpNYOpenMinStart = 0; // NY Open Start Minute
input int InpNYOpenMinEnd = 15; // NY Open End Minute
input group "=== VISUAL SETTINGS ==="
input color InpColorCheap = clrLimeGreen;
input color InpColorNormal = clrDodgerBlue;
input color InpColorExpensive = clrCrimson;
input string InpPrefix = "CJ5_"; // Object Prefix
//--- Global Variables
double g_pipPoint = 0.0001;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
int digits = (int)SymbolInfoInteger(_Symbol, SYMBOL_DIGITS);
double point = SymbolInfoDouble(_Symbol, SYMBOL_POINT);
g_pipPoint = (digits == 3 || digits == 5) ? point * 10.0 : point;
CreateDashboard();
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectsDeleteAll(0, InpPrefix);
}
//+------------------------------------------------------------------+
//| Helper: Classify execution cost bucket |
//+------------------------------------------------------------------+
void EvaluateCost(datetime barTime, double spreadPips, string &outTag, color &outColor, bool &outLimitOnly)
{
bool isExpensiveTime = false;
if(InpUseTimeFilter)
{
MqlDateTime tm;
TimeToStruct(barTime, tm);
bool isLondonOpen = (tm.hour == InpLonOpenHour && tm.min >= InpLonOpenMinStart && tm.min < InpLonOpenMinEnd);
bool isNYOpen = (tm.hour == InpNYOpenHour && tm.min >= InpNYOpenMinStart && tm.min < InpNYOpenMinEnd);
if(isLondonOpen || isNYOpen)
isExpensiveTime = true;
}
if(spreadPips >= InpExpensiveSpreadPips || isExpensiveTime)
{
outTag = "EXPENSIVE";
outColor = InpColorExpensive;
outLimitOnly = true;
}
else if(spreadPips <= InpCheapSpreadPips)
{
outTag = "CHEAP";
outColor = InpColorCheap;
outLimitOnly = false;
}
else
{
outTag = "NORMAL";
outColor = InpColorNormal;
outLimitOnly = false;
}
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
if(rates_total < 3) return(0);
// 1. Calculate Live Spread & Update Dashboard
double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
double bid = SymbolInfoDouble(_Symbol, SYMBOL_BID);
double liveSpreadPips = (ask - bid) / g_pipPoint;
string liveTag = "";
color liveColor = clrWhite;
bool liveLimitOnly = false;
EvaluateCost(TimeCurrent(), liveSpreadPips, liveTag, liveColor, liveLimitOnly);
UpdateDashboard(liveSpreadPips, liveTag, liveColor, liveLimitOnly);
// 2. Iterate Historical Bars
int startIndex = (prev_calculated > 1) ? prev_calculated - 1 : 1;
for(int i = startIndex; i < rates_total - 1; i++)
{
double barSpreadPips = (spread[i] > 0) ? (spread[i] * SymbolInfoDouble(_Symbol, SYMBOL_POINT) / g_pipPoint) : liveSpreadPips;
string tag = "";
color tagColor = clrWhite;
bool limitOnly = false;
EvaluateCost(time[i], barSpreadPips, tag, tagColor, limitOnly);
// Example setup trigger: replace with your liquidity sweep / PA logic
bool bullEngulf = (close[i] > open[i] && close[i-1] < open[i-1] && close[i] > open[i-1] && open[i] < close[i-1]);
bool bearEngulf = (close[i] < open[i] && close[i-1] > open[i-1] && close[i] < open[i-1] && open[i] > close[i-1]);
string objName = InpPrefix + "Tag_" + TimeToString(time[i]);
if(bullEngulf && ObjectFind(0, objName) < 0)
{
string text = StringFormat("[BULL] %s | %s", tag, limitOnly ? "LIMIT ONLY" : "MARKET OK");
CreateChartLabel(objName, time[i], low[i] - (15 * g_pipPoint), text, tagColor, ANCHOR_TOP);
}
else if(bearEngulf && ObjectFind(0, objName) < 0)
{
string text = StringFormat("[BEAR] %s | %s", tag, limitOnly ? "LIMIT ONLY" : "MARKET OK");
CreateChartLabel(objName, time[i], high[i] + (15 * g_pipPoint), text, tagColor, ANCHOR_BOTTOM);
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
//| Dashboard UI Helpers |
//+------------------------------------------------------------------+
void CreateDashboard()
{
string name = InpPrefix + "HUD";
if(ObjectFind(0, name) < 0)
{
ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, 25);
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 10);
ObjectSetString(0, name, OBJPROP_FONT, "Consolas");
}
}
void UpdateDashboard(double spreadPips, string tag, color tagColor, bool limitOnly)
{
string name = InpPrefix + "HUD";
string text = StringFormat("Spread: %.1f pips | Cost: %s (%s)",
spreadPips, tag, limitOnly ? "LIMIT REQUIRED" : "MARKET OK");
ObjectSetString(0, name, OBJPROP_TEXT, text);
ObjectSetInteger(0, name, OBJPROP_COLOR, tagColor);
}
void CreateChartLabel(string name, datetime t, double price, string text, color clr, ENUM_ANCHOR_POINT anchor)
{
ObjectCreate(0, name, OBJ_TEXT, 0, t, price);
ObjectSetString(0, name, OBJPROP_TEXT, text);
ObjectSetString(0, name, OBJPROP_FONT, "Arial Bold");
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 8);
ObjectSetInteger(0, name, OBJPROP_COLOR, clr);
ObjectSetInteger(0, name, OBJPROP_ANCHOR, anchor);
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
Key Adjustments for Your Setup
Broker Server Time Sync:
Both indicators default to InpLonOpenHour = 8 and InpNYOpenHour = 13. If your broker's server runs on UTC+2 or UTC+3 (standard Eastern European Time), adjust InpLonOpenHour (usually 09:00 or 10:00 server time) to match the real open of the session.
Replacing the Trigger:
The engulfing pattern inside the OnCalculate loop is a placeholder. You can plug your candle structure, liquidity grab, or range break condition directly into the bullEngulf and bearEngulf booleans.
Execution Guardrails in EAs:
If you automate this logic into an Expert Advisor, use the function EvaluateCost() directly before calling OrderSend(). If outLimitOnly == true, route the order to OP_BUYLIMIT / ORDER_TYPE_BUY_LIMIT instead of firing a market order into the spread spike.
Broker Server Time Sync:
Both indicators default to InpLonOpenHour = 8 and InpNYOpenHour = 13. If your broker's server runs on UTC+2 or UTC+3 (standard Eastern European Time), adjust InpLonOpenHour (usually 09:00 or 10:00 server time) to match the real open of the session.
Replacing the Trigger:
The engulfing pattern inside the OnCalculate loop is a placeholder. You can plug your candle structure, liquidity grab, or range break condition directly into the bullEngulf and bearEngulf booleans.
Execution Guardrails in EAs:
If you automate this logic into an Expert Advisor, use the function EvaluateCost() directly before calling OrderSend(). If outLimitOnly == true, route the order to OP_BUYLIMIT / ORDER_TYPE_BUY_LIMIT instead of firing a market order into the spread spike.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: EURUSD journal: how cost tags changed my behavior
cTrader’s C# API (cAlgo) handles this significantly better than MT4/MT5 because you can lock the indicator's internal time strictly to UTC using the [Indicator] attribute. This eliminates the need to adjust code every time daylight saving shifts or if you change brokers with different server offsets.
Historical bars in cTrader do not store raw tick spreads in the standard Bars object, so historical tags rely on the time-window filters, while the live HUD and current-bar tagging pull the exact real-time spread via Symbol.Spread.
Historical bars in cTrader do not store raw tick spreads in the standard Bars object, so historical tags rely on the time-window filters, while the live HUD and current-bar tagging pull the exact real-time spread via Symbol.Spread.
Code: Select all
using System;
using cAlgo.API;
using cAlgo.API.Internals;
namespace cAlgo
{
[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class CostJournalTagger : Indicator
{
[Parameter("Cheap Spread (Pips)", DefaultValue = 0.4, Group = "Spread Thresholds")]
public double CheapSpreadPips { get; set; }
[Parameter("Expensive Spread (Pips)", DefaultValue = 1.1, Group = "Spread Thresholds")]
public double ExpensiveSpreadPips { get; set; }
[Parameter("Use Time Filter", DefaultValue = true, Group = "Time Windows")]
public bool UseTimeFilter { get; set; }
[Parameter("London Open Hour (UTC)", DefaultValue = 8, Group = "Time Windows")]
public int LonOpenHour { get; set; }
[Parameter("NY Open Hour (UTC)", DefaultValue = 13, Group = "Time Windows")]
public int NyOpenHour { get; set; }
[Parameter("Open Duration (Minutes)", DefaultValue = 15, Group = "Time Windows")]
public int OpenDurationMins { get; set; }
private const string HudName = "CostHud";
protected override void Initialize()
{
Chart.DrawStaticText(HudName, "Initializing Cost HUD...", VerticalAlignment.Top, HorizontalAlignment.Right, Color.White);
}
public override void Calculate(int index)
{
if (index < 1) return;
DateTime barTime = Bars.OpenTimes[index];
bool isExpensiveTime = IsHighCostWindow(barTime);
string tag;
Color color;
bool limitOnly;
// Apply live spread to the hard right edge; use time-proxy for historical
if (IsLastBar)
{
double currentSpread = Symbol.Spread / Symbol.PipSize;
EvaluateCost(currentSpread, isExpensiveTime, out tag, out color, out limitOnly);
UpdateHud(currentSpread, tag, color, limitOnly);
}
else
{
EvaluateCost(0, isExpensiveTime, out tag, out color, out limitOnly);
}
// =========================================================================
// PROXY PRICE ACTION SETUP (Replace with your daily/15m raw PA triggers)
// =========================================================================
bool bullEngulf = Bars.ClosePrices[index] > Bars.OpenPrices[index] &&
Bars.ClosePrices[index - 1] < Bars.OpenPrices[index - 1] &&
Bars.ClosePrices[index] > Bars.OpenPrices[index - 1] &&
Bars.OpenPrices[index] < Bars.ClosePrices[index - 1];
bool bearEngulf = Bars.ClosePrices[index] < Bars.OpenPrices[index] &&
Bars.ClosePrices[index - 1] > Bars.OpenPrices[index - 1] &&
Bars.ClosePrices[index] < Bars.OpenPrices[index - 1] &&
Bars.OpenPrices[index] > Bars.ClosePrices[index - 1];
// =========================================================================
// CHART TAGGING
// =========================================================================
string objectName = $"Tag_{index}";
if (bullEngulf)
{
double yPos = Bars.LowPrices[index] - (10 * Symbol.PipSize);
string text = $"[BULL]\nCost: {tag}\n{(limitOnly ? "LIMIT REQUIRED" : "MARKET OK")}";
var chartText = Chart.DrawText(objectName, text, index, yPos, color);
chartText.VerticalAlignment = VerticalAlignment.Top;
chartText.HorizontalAlignment = HorizontalAlignment.Center;
chartText.FontSize = 9;
chartText.IsBold = true;
}
else if (bearEngulf)
{
double yPos = Bars.HighPrices[index] + (10 * Symbol.PipSize);
string text = $"[BEAR]\nCost: {tag}\n{(limitOnly ? "LIMIT REQUIRED" : "MARKET OK")}";
var chartText = Chart.DrawText(objectName, text, index, yPos, color);
chartText.VerticalAlignment = VerticalAlignment.Bottom;
chartText.HorizontalAlignment = HorizontalAlignment.Center;
chartText.FontSize = 9;
chartText.IsBold = true;
}
}
private bool IsHighCostWindow(DateTime time)
{
if (!UseTimeFilter) return false;
bool isLondonOpen = time.Hour == LonOpenHour && time.Minute < OpenDurationMins;
bool isNyOpen = time.Hour == NyOpenHour && time.Minute < OpenDurationMins;
return isLondonOpen || isNyOpen;
}
private void EvaluateCost(double spreadPips, bool isExpensiveTime, out string tag, out Color color, out bool limitOnly)
{
// If historical (spreadPips == 0), evaluate purely on the time filter.
if (isExpensiveTime || (spreadPips > 0 && spreadPips >= ExpensiveSpreadPips))
{
tag = "EXPENSIVE";
color = Color.Crimson;
limitOnly = true;
}
else if (spreadPips > 0 && spreadPips <= CheapSpreadPips)
{
tag = "CHEAP";
color = Color.LimeGreen;
limitOnly = false;
}
else
{
tag = "NORMAL";
color = Color.DodgerBlue;
limitOnly = false;
}
}
private void UpdateHud(double spreadPips, string tag, Color tagColor, bool limitOnly)
{
string execRule = limitOnly ? "LIMIT REQUIRED" : "MARKET OK";
string text = $"Spread: {Math.Round(spreadPips, 1)} pips\nCost Window: {tag}\nRule: {execRule}";
Chart.DrawStaticText(HudName, text, VerticalAlignment.Top, HorizontalAlignment.Right, tagColor);
}
}
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.