I have this code to color a candle and it's works fine, but how do i change the code so the width of the candle follow the size of a candle whenever i zoom in and out on the chart?
I want to code it so it make the width of the orange candles to fill the whole candle and not only a part of it and then when i zoom out i want the width to fit the candle again. Hope it's understandable otherwise just ask
I want to code it so it make the width of the orange candles to fill the whole candle and not only a part of it and then when i zoom out i want the width to fit the candle again. Hope it's understandable otherwise just ask
Inserted Code
//+------------------------------------------------------------------+ //| eCandle.mq4 | //| Copyright 2019, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 clrOrange #property indicator_color2 clrOrange #property indicator_width1 7 #property indicator_width2 7 double BodyHigh[],BodyLow[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,BodyHigh); SetIndexBuffer(1,BodyLow); SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexStyle(1,DRAW_HISTOGRAM); //--- 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[]) { //--- for(int i = MathMax(Bars-2-IndicatorCounted(),1); i>=0;i--) { double hi=high[i], lo=low[i], prevhi=high[i+1], prevlo=low[i+1]; double bodyhigh=MathMax(close[i], open[i]); double bodylow=MathMin(close[i], open[i]); if(hi>prevhi&&lo<prevlo) { BodyHigh[i]=bodyhigh; BodyLow[i]=bodylow; } } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
Blindly following others will make you blind!