//+------------------------------------------------------------------+ //| TF_I_HeikinAshi.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 description "Das ist der Heikin Ashi Indikator" #property description "erstellt von Thorsten Fischer" #property strict #property indicator_chart_window #property indicator_buffers 7 #property indicator_plots 1 //--- plot Kerzen #property indicator_type1 DRAW_COLOR_CANDLES #property indicator_label1 "HA_Open;HA_High;HA_Low;HA_Close" #property indicator_color1 clrBlue,clrRed //#property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- indicator buffers double HA_Buffer_O[]; double HA_Buffer_H[]; double HA_Buffer_L[]; double HA_Buffer_C[]; double HA_Colors[]; double HA_Shadow[]; double HA_Retracement[]; //+------------------------------------------------------------------+ //| 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_Colors,INDICATOR_COLOR_INDEX); SetIndexBuffer(5,HA_Shadow,INDICATOR_CALCULATIONS); SetIndexBuffer(6,HA_Retracement,INDICATOR_CALCULATIONS); //--- IndicatorSetString(INDICATOR_SHORTNAME,"TF Heikin Ashi Kerzen"); IndicatorSetInteger(INDICATOR_DIGITS,_Digits); PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0.0); PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,0.0); //--- 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 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_Shadow[0]=0.0; HA_Retracement[0]=rates_total; } for(i; i