//+------------------------------------------------------------------+ //| V0.mq5 | //| Thorsten Fischer Copyright 2019-2020 | //| https://mql5.tfsystem.de | //+------------------------------------------------------------------+ #property copyright "Thorsten Fischer Copyright 2019-2020" #property link "https://mql5.tfsystem.de" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 5 #property indicator_plots 1 //--- input string KerzenName="HA_Open;HA_High;HA_Low;HA_Close"; // Namen der Kerzenpunkte input color KerzenNeutral=clrGray; // Kerzenfarbe Neutral input color KerzenLong=clrBlue; // Kerzenfarbe Long input color KerzenShort=clrRed; // Kerzenfarbe Short //--- indicator buffers double HA_Buffer_O[]; double HA_Buffer_H[]; double HA_Buffer_L[]; double HA_Buffer_C[]; double HA_Buffer_Colors[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,HA_Buffer_O,INDICATOR_DATA); SetIndexBuffer(1,HA_Buffer_H,INDICATOR_DATA); SetIndexBuffer(2,HA_Buffer_L,INDICATOR_DATA); SetIndexBuffer(3,HA_Buffer_C,INDICATOR_DATA); SetIndexBuffer(4,HA_Buffer_Colors,INDICATOR_COLOR_INDEX); //--- PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_COLOR_CANDLES); PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,1); PlotIndexSetInteger(0,PLOT_COLOR_INDEXES,3); PlotIndexSetInteger(0,PLOT_LINE_COLOR,0,KerzenNeutral); PlotIndexSetInteger(0,PLOT_LINE_COLOR,1,KerzenLong); PlotIndexSetInteger(0,PLOT_LINE_COLOR,2,KerzenShort); //PlotIndexSetInteger(0,PLOT_LINE_WIDTH,4); PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); PlotIndexSetString(0,PLOT_LABEL,KerzenName); //--- IndicatorSetString(INDICATOR_SHORTNAME,"TF Heikin Ashi Kerzen"); IndicatorSetInteger(INDICATOR_DIGITS,_Digits); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| 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 i=prev_calculated-1; double haO,haH,haL,haC; //--- if(i==-1) { i=1; HA_Buffer_O[0]=open[0]; HA_Buffer_H[0]=high[0]; HA_Buffer_L[0]=low[0]; HA_Buffer_C[0]=close[0]; HA_Buffer_Colors[0]=(open[0]==close[0])?0:(open[0]