
//+------------------------------------------------------------------+
//| ProjectName |
//| Copyright 2020, CompanyName |
//| http://www.companyname.net |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Pointer.mq5 |
//| Copyright 2024, AM2 |
//| http://www.forexsystems.biz |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, AM2"
#property link "http://www.forexsystems.biz"
#property version "1.00"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots 2
#property indicator_label1 "Signal UP"
#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrLime
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
#property indicator_label2 "Signal DN"
#property indicator_type2 DRAW_ARROW
#property indicator_color2 clrRed
#property indicator_style2 STYLE_SOLID
#property indicator_width2 2
double up[11],dn[11];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping
SetIndexBuffer(0,up,INDICATOR_DATA);
PlotIndexSetInteger(0,PLOT_ARROW,233);
SetIndexBuffer(1,dn,INDICATOR_DATA);
PlotIndexSetInteger(1,PLOT_ARROW,234);
//---
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[])
{
//---
ArraySetAsSeries(low,true);
ArraySetAsSeries(open,true);
ArraySetAsSeries(close,true);
ArraySetAsSeries(high,true);
for(int i=0; i<111; i++)
{
if(close[i] > high[i+1] && close[i] > high[i+2] && close[i] > high[i+3])
{
up[i]=low[i];
}
if(close[i] < low[i+1] && close[i] < low[i+2] && close[i] < low[i+3])
{
dn[i]=high[i];
}
}
Comment(close[55]);
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
AM2