Hey , I have not yet worked on indicators that much and therefore I'm now facing a problem that might be easy to solve for soeme or does not make any sense. The Indicator Automatic Trendlines paints a candle which fufills certain criteria in a colour. Now I want to create an indicator thats relys on that candle, I have the value imported through the iCustom function, but I have not yet been able to understand how I can save the value in regards to getting the date from that day where the criteria is fullfilled. I need the distance from the candle which is the newest at that point to the last painted candle which is either a resistance or support candle. I researched and found out about the Bars() function but I do not know how to get the specific dates for the candles. The indicator does only Print out a value when the criteria is fullfilled otherwise it is an EMPTY_VALUE.
Is there any way to getthat date from the candle which fullfills the criteria to use the Bars() function or is there any other way to get the number of candles that have passed since that certain candle ? Help is appreciated.
I'm looking for the same thing myself. I'd like to know if you found a way
Hi
I not sure if I understood what you really need here, but if the indicator returns those displayed candles as indicator buffers. You can simply check the value of this indicator for each candle (Shift) and then get the time of this candle(shift). For example:
ArraySetAsSeries(BufferTREND, true); //set array with indicator avlues as series (indexed as bars on the chart) //find last bar with no empty value for(int i=0; i<rates_total;i++){ if(BufferTREND!=EMPTY_VALUE){ //here you can msave the index/time of the signal candle or make necessary calculations(count distance etc) int indexCandle = i; datetime timeCandle = Time( break; } } … datetime Time(int i){ datetime times[1]; int copied = CopyTime(NULL, 0, i, 1,times); if(copied < 1){ //Print("Error: Download date time array problem: "+IntegerToString(GetLastError())); return 0; } return times[0]; }
Best Regards
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey , I have not yet worked on indicators that much and therefore I'm now facing a problem that might be easy to solve for soeme or does not make any sense. The Indicator Automatic Trendlines paints a candle which fufills certain criteria in a colour. Now I want to create an indicator thats relys on that candle, I have the value imported through the iCustom function, but I have not yet been able to understand how I can save the value in regards to getting the date from that day where the criteria is fullfilled. I need the distance from the candle which is the newest at that point to the last painted candle which is either a resistance or support candle. I researched and found out about the Bars() function but I do not know how to get the specific dates for the candles. The indicator does only Print out a value when the criteria is fullfilled otherwise it is an EMPTY_VALUE.
Is there any way to getthat date from the candle which fullfills the criteria to use the Bars() function or is there any other way to get the number of candles that have passed since that certain candle ? Help is appreciated.