0% found this document useful (0 votes)
16 views7 pages

Smart Money Concepts

The document is a MetaTrader 4 (MT4) script for a trading indicator called SmartMoneyConcepts, which analyzes price movements and detects swing highs and lows. It includes customizable parameters for timeframes, swing lookback, and visual elements such as colors for different market conditions. The script calculates and displays equal highs/lows, structure changes, and draws zones on the chart to assist traders in making informed decisions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Smart Money Concepts

The document is a MetaTrader 4 (MT4) script for a trading indicator called SmartMoneyConcepts, which analyzes price movements and detects swing highs and lows. It includes customizable parameters for timeframes, swing lookback, and visual elements such as colors for different market conditions. The script calculates and displays equal highs/lows, structure changes, and draws zones on the chart to assist traders in making informed decisions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

//+------------------------------------------------------------------+

//| SmartMoneyConcepts.mq4 |

//+------------------------------------------------------------------ +

#property indicator_chart_window

#property strict

#include <stdlib.mqh>

#include <ChartObjects\ChartObjectsTxtControls.mqh>

//--- Input parameters

input ENUM_TIMEFRAMES TimeFrame = 0; // 0 = Current, else select H1, M15, etc.

input int SwingLookback = 5; // Number of candles to look back for swing detection

input double EqualRange = 5; // Points tolerance for Equal High/Low

input color BOSColor = clrBlue;

input color CHOCHColor = clrRed;

input color EQHColor = clrTeal;

input color EQLColor = clrOrange;

input color SupplyColor = clrRed;

input color DemandColor = clrDodgerBlue;

input int ZoneBoxWidth = 50;

//--- Buffers

double BOSBuffer[];

double CHOCHBuffer[];
//--- Variables

bool isUpTrend = true;

double lastHigh = 0, lastLow = 0;

//+------------------------------------------------------------------+

//| Initialization |

//+------------------------------------------------------------------ +

int OnInit()

IndicatorBuffers(2);

SetIndexBuffer(0, BOSBuffer);

SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 2, BOSColor);

SetIndexArrow(0, 233);

SetIndexBuffer(1, CHOCHBuffer);

SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 2, CHOCHColor);

SetIndexArrow(1, 234);

return INIT_SUCCEEDED;

//+------------------------------------------------------------------ +

//| Main Calculate |

//+------------------------------------------------------------------ +
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[])

int limit = rates_total - SwingLookback - 1;

for (int i = limit; i >= 1; i--)

double currHigh = GetPrice(TimeFrame, MODE_HIGH, i);

double currLow = GetPrice(TimeFrame, MODE_LOW, i);

// Detect Equal High

if (MathAbs(currHigh - GetPrice(TimeFrame, MODE_HIGH, i + 1)) <= EqualRange *


Point)

DrawText("EQH" + i, "EQH", i, currHigh, EQHColor);

// Detect Equal Low

if (MathAbs(currLow - GetPrice(TimeFrame, MODE_LOW, i + 1)) <= EqualRange * Point)

DrawText("EQL" + i, "EQL", i, currLow, EQLColor);


// Detect structure change

if (currHigh > lastHigh)

if (!isUpTrend)

CHOCHBuffer[i] = high[i];

DrawZone("DemandZone" + i, Time[i], low[i], DemandColor);

DrawText("CHOCH" + i, "CHOCH", i, high[i], CHOCHColor);

isUpTrend = true;

else

BOSBuffer[i] = high[i];

DrawZone("DemandZone" + i, Time[i], low[i], DemandColor);

DrawText("BOS" + i, "BOS", i, high[i], BOSColor);

lastHigh = currHigh;

if (currLow < lastLow)

if (isUpTrend)

CHOCHBuffer[i] = low[i];
DrawZone("SupplyZone" + i, Time[i], high[i], SupplyColor);

DrawText("CHOCH" + i, "CHOCH", i, low[i], CHOCHColor);

isUpTrend = false;

else

BOSBuffer[i] = low[i];

DrawZone("SupplyZone" + i, Time[i], high[i], SupplyColor);

DrawText("BOS" + i, "BOS", i, low[i], BOSColor);

lastLow = currLow;

return rates_total;

//+------------------------------------------------------------------ +

//| Get Price MTF |

//+------------------------------------------------------------------ +

double GetPrice(ENUM_TIMEFRAMES tf, int type, int shift)

if (tf == 0)

if (type == MODE_HIGH) return High[shift];


if (type == MODE_LOW) return Low[shift];

else

datetime t = iTime(_Symbol, tf, shift);

int i = iBarShift(_Symbol, PERIOD_CURRENT, t, false);

if (i >= 0)

if (type == MODE_HIGH) return High[i];

if (type == MODE_LOW) return Low[i];

return 0;

//+------------------------------------------------------------------+

//| Draw Zone Boxes |

//+------------------------------------------------------------------ +

void DrawZone(string name, datetime timeStart, double price, color clr)

datetime timeEnd = timeStart + ZoneBoxWidth * PeriodSeconds();

string boxName = name + TimeToStr(timeStart, TIME_MINUTES);

ObjectCreate(0, boxName, OBJ_RECTANGLE, 0, timeStart, price + 10 * Point, timeEnd,


price - 10 * Point);

ObjectSetInteger(0, boxName, OBJPROP_COLOR, clr);


ObjectSetInteger(0, boxName, OBJPROP_STYLE, STYLE_SOLID);

ObjectSetInteger(0, boxName, OBJPROP_WIDTH, 1);

ObjectSetInteger(0, boxName, OBJPROP_BACK, true);

ObjectSetInteger(0, boxName, OBJPROP_CORNER, 0);

ObjectSetInteger(0, boxName, OBJPROP_RAY_RIGHT, false);

//+------------------------------------------------------------------ +

//| Draw Text Labels |

//+------------------------------------------------------------------ +

void DrawText(string name, string text, int index, double price, color clr)

string label = name + IntegerToString(index);

ObjectCreate(0, label, OBJ_TEXT, 0, Time[index], price);

ObjectSetInteger(0, label, OBJPROP_COLOR, clr);

ObjectSetInteger(0, label, OBJPROP_FONTSIZE, 9);

ObjectSetString(0, label, OBJPROP_TEXT, text);

You might also like