Re: Raw Spread vs. Standard Account: The Complete Execution & Cost Guide for Scalpers and Algorithmic Traders
Posted: Mon Sep 28, 2026 9:16 pm
MQL4 Version (For MetaTrader 4)
If you are still running legacy systems on MT4, use this MQL4 equivalent. Create a new Expert Advisor in MetaEditor 4 and attach it to any active chart.
If you are still running legacy systems on MT4, use this MQL4 equivalent. Create a new Expert Advisor in MetaEditor 4 and attach it to any active chart.
Code: Select all
//+------------------------------------------------------------------+
//| LiveCostMonitor_MT4.mq4 |
//+------------------------------------------------------------------+
#property copyright "Forex-Scalping.com"
#property link "https://forex-scalping.com"
#property version "1.00"
#property strict
extern double CommissionPerLot = 7.0; // Round-turn commission in USD
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
// Retrieve live spread in points
double spread_points = MarketInfo(Symbol(), MODE_SPREAD);
// Retrieve the monetary value of one tick/point for 1 Standard Lot
double tick_value = MarketInfo(Symbol(), MODE_TICKVALUE);
// Calculate exact monetary cost of the spread
double spread_cost = spread_points * tick_value;
// Calculate total friction (Spread Cost + Commission)
double total_cost = spread_cost + CommissionPerLot;
// Format the dashboard
string dashboard = "--- LIVE TRANSACTION COST (1 LOT) ---\n";
dashboard += "Spread: " + DoubleToString(spread_points, 0) + " points\n";
dashboard += "Spread Cost: $" + DoubleToString(spread_cost, 2) + "\n";
dashboard += "Commission: $" + DoubleToString(CommissionPerLot, 2) + "\n";
dashboard += "Total Friction: $" + DoubleToString(total_cost, 2) + "\n";
dashboard += "-------------------------------------";
// Display directly on the chart using Comment
Comment(dashboard);
}