Hi guys,
I'm new here and have a beginner's question:
I try to create a custom indicator which will set symbols above my bars to signals me to buy or to sell. This indicator should access other indicators (exponential MA 3 and 7) and signal me if the EMA 3 is above or below the EMA 7. How can I access the results of other (built-in) indicators in my own custom indicator?
This is my (reduced) OnCalculate method:
Thanks in advance!
Great, thank you, that was exactly the article I was looking for (didn't find it before).
Thanks to the information provided I was able to build it but stumbled over a little problem:
In the OnCalculation method the price in close[i], open[i], high[i] and low[i] is always the same for every loop over the rates.
What am I doing wrong?
Great, thank you, that was exactly the article I was looking for (didn't find it before).
Thanks to the information provided I was able to build it but stumbled over a little problem:
In the OnCalculation method the price in close[i], open[i], high[i] and low[i] is always the same for every loop over the rates.
What am I doing wrong?
I reduced the code as much as I could to keep it simple, I just want to check if the close price is below the open price:
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[]) { //--- Block for calculating indicator values int start=1; if(prev_calculated>0) start=prev_calculated-1; //--- Calculation loop for(int i=start;i<rates_total;i++) { bool isRedCandle = close[i]<open[i]; MarkBuffer[i]=isRedCandle ? high[i]: 0;
But the close, open, high and low prices are always the same when I run the debug mode and step through the loop.
- www.mql5.com
I reduced the code as much as I could to keep it simple, I just want to check if the close price is below the open price:
But the close, open, high and low prices are always the same when I run the debug mode and step through the loop.
Actually no, it doesn't, sorry. I have no idea why the prices are the same in all arrays (same slot).
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi guys,
I'm new here and have a beginner's question:
I try to create a custom indicator which will set symbols above my bars to signals me to buy or to sell. This indicator should access other indicators (exponential MA 3 and 7) and signal me if the EMA 3 is above or below the EMA 7. How can I access the results of other (built-in) indicators in my own custom indicator?
This is my (reduced) OnCalculate method:
Thanks in advance!