//+------------------------------------------------------------------+
//| Test_FractalsOnArray.mq5 |
//| Integer |
//| https://login.mql5.com/ru/users/Integer |
//+------------------------------------------------------------------+
#property copyright "Integer"
#property link "https://login.mql5.com/ru/users/Integer"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 4
#property indicator_plots 2
//--- plot Label1
#property indicator_label1 "Label1"
#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrRed
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- plot Label2
#property indicator_label2 "Label2"
#property indicator_type2 DRAW_ARROW
#property indicator_color2 clrRed
#property indicator_style2 STYLE_SOLID
#property indicator_width2 1
//--- indicator buffers
double UBuffer[];
double LBuffer[];
double DataHigh[];
double DataLow[];
#include <IncOnArray/IncFractalsOnArray.mqh>
CFractalsOnArray fr;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,UBuffer,INDICATOR_DATA);
SetIndexBuffer(1,LBuffer,INDICATOR_DATA);
SetIndexBuffer(2,DataHigh,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,DataLow,INDICATOR_CALCULATIONS);
//--- setting a code from the Wingdings charset as the property of PLOT_ARROW
PlotIndexSetInteger(0,PLOT_ARROW,159);
PlotIndexSetInteger(1,PLOT_ARROW,159);
//---
return(0);
}
//+------------------------------------------------------------------+
//| 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 start;
if(prev_calculated>0)
{
start=prev_calculated-1;
}
else
{
start=0;
}
for(int i=start;i<rates_total;i++)
{
DataHigh[i]=high[i];
DataLow[i]=low[i];
}
fr.Solve(rates_total,prev_calculated,DataHigh,DataLow,UBuffer,LBuffer);
return(rates_total);
}
//+------------------------------------------------------------------+
Comments