Hello
I am a beginner, i just try to say:
It is mean that close 0 is above all closes of the last 900 candles,
but i need to say that close 0 is above close 1 or above close 2 ... to the last 900 candles!
when i write:
it dose not work of course and i know that, but i need something like this to use!
I don’t understand what it is that you are trying to do
I try to short this conditions:
if ( Close[i] > Close[1+i] || Close[i] > Close[2+i] || Close[i] > Close[3+i] || Close[i] > Close[4+i] || Close[i] > Close[5+i] || Close[i] > Close[6+i] || Close[i] > Close[7+i] || Close[i] > Close[8+i] || Close[i] > Close[9+i] || Close[i] > Close[10+i] || Close[i] > Close[11+i] || Close[i] > Close[12+i])
It may be reach to Close[900+i]
-
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon.You have been repeatedly told where to post your MT4 question. Why do you insist in violating the rules?
@William Roeder "Please say something useful or be silent" :)
As requested, live in ignorance. 1 2 3
BTW, the answer is one function call and you have two choices.
- Ahmed Abd El Aziz: It is mean that close 0 is above all closes of the last 900 candles,
Sorry Dominik, that is not the same as all candles are in order, which will never happen.
void OnStart() { bool conditionCheckResult = thisCondition(Close, 1, 900); } bool thisCondition(const double &serie[], int index, int depth) { int limit = index + depth + 1; if(limit > ArraySize(serie)) limit = ArraySize(serie); for(int i = index + 1; i < limit; i++) if(serie[index] > serie[i]) return(true); return(false); }
P.S. not tested
-
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon.You have been repeatedly told where to post your MT4 question. Why do you insist in violating the rules
Be calm, it is MQL5 Question :)
#property indicator_separate_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_HISTOGRAM #property indicator_style1 STYLE_SOLID #property indicator_width1 1 #property indicator_color1 0xFFAA00 #property indicator_label1 "Low" //--- indicator buffers double Buffer1[]; double myPoint; double Open[]; double High[]; double Low[]; double Close[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer(0, Buffer1); PlotIndexSetDouble(0, PLOT_EMPTY_VALUE, EMPTY_VALUE); //initialize myPoint myPoint = Point(); if(Digits() == 2 || Digits() == 3 || Digits() == 4 || Digits() == 5) { myPoint *= 10; } 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 limit = rates_total - prev_calculated; //--- counting from 0 to rates_total ArraySetAsSeries(Buffer1, true); //--- initial zero if(prev_calculated < 1) { ArrayInitialize(Buffer1, EMPTY_VALUE); } else limit++; if(CopyOpen(Symbol(), PERIOD_CURRENT, 0, rates_total, Open) <= 0) return(rates_total); ArraySetAsSeries(Open, true); if(CopyHigh(Symbol(), PERIOD_CURRENT, 0, rates_total, High) <= 0) return(rates_total); ArraySetAsSeries(High, true); if(CopyLow(Symbol(), PERIOD_CURRENT, 0, rates_total, Low) <= 0) return(rates_total); ArraySetAsSeries(Low, true); if(CopyClose(Symbol(), PERIOD_CURRENT, 0, rates_total, Close) <= 0) return(rates_total); ArraySetAsSeries(Close, true); //--- main loop for(int i = limit-1; i >= 0; i--) { if (i >= MathMin(200000-1, rates_total-1-900)) continue; //omit some old rates to prevent "Array out of range" or slow calculation //Indicator Buffer 1 if(((Close[i]>Close[1+i])||(Close[i]>Close[2+i])||(Close[i]>Close[3+i])) ) { Buffer1[i] = Low[i]; } else { Buffer1[i] = 0; } } return(rates_total); } //+------------------------------------------------------------------+
William Roeder
BTW, the answer is one function call and you have two choices.
Is that a mystery?
-
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon.You have been repeatedly told where to post your MT4 question. Why do you insist in violating the rules?
-
As requested, live in ignorance. 1 2 3
BTW, the answer is one function call and you have two choices.
-
Sorry Dominik, that is not the same as all candles are in order, which will never happen.
Dominik Christian Egert #: William, I don't understand. Could you please explain what you mean with "in order"?
for(int cnt = 1; (cnt <= 900) && !_StopFlag && !is_true; cnt++) { is_true |= (close[i] > close[cnt+i]); }
I misread that previously. You get true if close[i] is not the lowest value. Not what OP wants.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I am a beginner, i just try to say:
It is mean that close 0 is above all closes of the last 900 candles,
but i need to say that close 0 is above close 1 or above close 2 ... to the last 900 candles!
when i write:
it dose not work of course and i know that, but i need something like this to use!