Disliked{quote} It doesn't matter if it's a channel or a line It is more important for me to see how I can find the peaks and compare their differences It can be any example, for example, how to draw a line between two peaks in MACD Actually, I need examples to learn how to choose the peaks in different indicators in different conditions and compare them. {image}Ignored
Inserted Code
int FindPeak(string symbol, ENUM_TIMEFRAMES timeframe, int mode, int count, int startBar) {
if (mode!=MODE_HIGH && mode!=MODE_LOW) return(-1);
int currentBar = startBar;
int foundBar = FindNextPeak(symbol, timeframe,mode, count*2+1, currentBar-count);
while (foundBar!=currentBar) {
currentBar = FindNextPeak(symbol, timeframe,mode, count, currentBar+1);
foundBar = FindNextPeak(symbol, timeframe,mode, count*2+1, currentBar-count);
}
return(currentBar);
}
int FindNextPeak(string symbol, ENUM_TIMEFRAMES timeframe, int mode, int count, int startBar) {
if (startBar<0) {
count += startBar;
startBar = 0;
}
return( (mode==MODE_HIGH) ?
iHighest(symbol, timeframe, (ENUM_SERIESMODE)mode, count, startBar) :
iLowest(symbol, timeframe, (ENUM_SERIESMODE)mode, count, startBar)
);
} Software Developer and Music Producer
News Fundamentals All Time Return:
1,159.1%
2