0% found this document useful (0 votes)
10 views3 pages

Revise

This document is a code for a custom indicator in a trading platform, defining properties, buffers, and inputs for visualizing market high and low points. It includes logic for marking highs and lows, as well as internal structures and breakouts. The indicator is designed to assist traders in analyzing market trends and making informed decisions.

Uploaded by

ali.bachari1982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Revise

This document is a code for a custom indicator in a trading platform, defining properties, buffers, and inputs for visualizing market high and low points. It includes logic for marking highs and lows, as well as internal structures and breakouts. The indicator is designed to assist traders in analyzing market trends and making informed decisions.

Uploaded by

ali.bachari1982
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#property indicator_chart_window

#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green

double BufferHigh[];
double BufferLow[];

// Inputs
input bool UseEqualHL = false;
input bool MarkHL = true;
input color HLColor = clrGray;

input bool MarkInternalStructure = false;


input color PivotHighColor = clrRed;
input color PivotLowColor = clrGreen;

input bool MarkBoSChoCH = true;


input color BullColor = clrGreen;
input color BearColor = clrRed;

input bool MarkPreviousIDM = true;


input bool MarkLiveIDM = true;
input color IDMColor = clrGray;

input bool ShowSweepingLines = true;


input color SweepLineColor = clrGray;

// Variables
bool mnUp = false;
bool mnDn = false;
double mnStrc = 0;

double H = 0, L = 0;
double lastH = 0, lastL = 0;
double lastHH = 0, lastLL = 0;
int Hbar = 0, Lbar = 0;
int lastHbar = 0, lastLbar = 0;
int lastHHbar = 0, lastLLbar = 0;

bool isBosUp = false;


bool isBosDn = false;
bool isCocUp = true;
bool isCocDn = true;

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
SetIndexBuffer(0, BufferHigh);
SetIndexBuffer(1, BufferLow);

SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 1, Red);


SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 1, Green);

ArraySetAsSeries(BufferHigh, true);
ArraySetAsSeries(BufferLow, true);
return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| 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[])
{
int limit = prev_calculated;
if (limit < 0) return(-1);
if (limit == 0) limit = rates_total - 1;

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


{
// Update High/Low variables
if (high[i] > H || i == rates_total - 1)
{
H = high[i];
Hbar = i;
}
if (low[i] < L || i == rates_total - 1)
{
L = low[i];
Lbar = i;
}

// Mark High/Low
if (MarkHL)
{
BufferHigh[i] = H;
BufferLow[i] = L;
}

// Structure mapping logic


if (high[i] > lastH)
{
if (low[i] < lastL)
{
isBosUp = false;
}
lastH = high[i];
lastHbar = i;
}
if (low[i] < lastL)
{
if (high[i] > lastH)
{
isBosDn = false;
}
lastL = low[i];
lastLbar = i;
}
}

return(rates_total);
}

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

You might also like