//+------------------------------------------------------------------+ //| 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 2 #property indicator_plots 1 //--- plot Kerzen #property indicator_type1 DRAW_HISTOGRAM //#property indicator_label1 "Docht/Lunte" ////#property indicator_color1 clrRed ////#property indicator_style1 STYLE_SOLID ////#property indicator_width1 1 ////--- plot Kerzen Körper //#property indicator_type2 DRAW_HISTOGRAM //#property indicator_label2 "Körper" ////#property indicator_color2 clrBlue ////#property indicator_style2 STYLE_SOLID ////#property indicator_width2 4 //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ input color I_Color_Long=clrBlue; input color I_Color_Short=clrRed; //--- 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(1,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