Setting Custom Timeframe on iMA Creates Problems

To add comments, please log in or register
Morgan Stiles
62
Morgan Stiles  

I have made an indicator that notifies of EMA in the M1 chart based on the status of MACD in a M15 chart.

This doesn't work when I have contradicting timeframes within my indicator.

e.g. 

      signalemabuffer[i]  = iMA(NULL, PERIOD_M1, SignalEMA,0,MODE_EMA,PRICE_OPEN,i);
      mediaryemabuffer[i] = iMA(NULL, PERIOD_M1, MediaryEMA,0,MODE_EMA,PRICE_OPEN,i);

                        vs.
      MacdBuffer[i]=iMA(NULL, PERIOD_M15, FastEMA,0,MODE_EMA,PRICE_OPEN,i) -
                    iMA(NULL, PERIOD_M15, SlowEMA,0,MODE_EMA,PRICE_OPEN,i);
      SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalEMA,0,MODE_EMA,i);

I have have ran a print function to ensure that this was the problem.

 double number = MacdBuffer[0]-SignalBuffer[0];
 Print("number: ",number);
      

And it definitely is.

I get the same number regardless of MACD and Signal line postions when timeframes of MACD and EMA are different.

If i set MACD timeframes to equal EMA timeframes then the the number changes according to actual MACD values.

So it is definitely an issue and I'm super stuck on it.

Any help is greatly appreciated.

Marco vd Heijden
Moderator
12703
Marco vd Heijden  
For custom timeframe you can use custom calculation independent of iMA.
William Roeder
20208
William Roeder  
    MacdBuffer[i]=iMA(NULL, PERIOD_M15, FastEMA,0,MODE_EMA,PRICE_OPEN,i) -
                    iMA(NULL, PERIOD_M15, SlowEMA,0,MODE_EMA,PRICE_OPEN,i);
You are mixing apples and oranges.
Morgan Stiles
62
Morgan Stiles  
Marco vd Heijden:
For custom timeframe you can use custom calculation independent of iMA.
whroeder1:
You are mixing apples and oranges.


So is it because I am using the iMA funciton for my MACD line?
I was thinking about supplementing the MACD code with an equation rather than the multiple iMA functions.

William Roeder
20208
William Roeder  
Morgan Stiles: So is it because I am using the iMA funciton for my MACD line?
No. It's because you are mixing timeframes. Read and understand the links provided.
Morgan Stiles
62
Morgan Stiles  
whroeder1:
No. It's because you are mixing timeframes. Read and understand the links provided.

That's the whole point of this indicator.
It's entire purpose is to calculate higher time frames and use those readings when calculating a smaller timeframe.

idk if you understand from the post, but my indicator is meant to be dependent on a larger timeframe while still reading a smaller timeframe.


Are you saying that this is impossible?

William Roeder
20208
William Roeder  
Morgan Stiles: That's the whole point of this indicator.

Are you saying that this is impossible?

You indicator is broken, fix your broken indicator.

Morgan Stiles
62
Morgan Stiles  
whroeder1:

You indicator is broken, fix your broken indicator.

That's why I'm here, these forums are here so we can help each other with stuff like this.


You seem somewhat knowledgeable about what is wrong here, could you please give me some hints on how I might fix this problem?


I really want to get better at coding mql4 and would greatly appreciate any help whatsoever.

William Roeder
20208
William Roeder  
Morgan Stiles: could you please give me some hints on how I might fix this problem?

I gave you links, you ignored them.

Morgan Stiles
62
Morgan Stiles  
whroeder1:

I gave you links, you ignored them.

No, I read them immediately, I do not see the relevance though.

The poster from the link had a much different problem than me, which is why I didn't think you had an understanding of my problem.


I've come here for help and I've paid great attention to what you have given me but I still cannot find a solution to my problem.

If you know what could fix my indicator, will you please help me?


Other wise you're kind of being a dick. I don't need you to waste my time, you don't have to be a part of the toxicity in these forums.

William Roeder
20208
William Roeder  
Morgan Stiles:

No, I read them immediately, I do not see the relevance though.

The poster from the link had a much different problem than me, which is why I didn't think you had an understanding of my problem.

I've come here for help and I've paid great attention to what you have given me but I still cannot find a solution to my problem.

If you know what could fix my indicator, will you please help me?

Other wise you're kind of being a dick. I don't need you to waste my time, you don't have to be a part of the toxicity in these forums.

  1. Then you failed to read and understand TimeScale problem - Indices - MQL4 and MetaTrader 4 - MQL4 programming forum #2.3 and Previous Day High-Low - Real Account - MQL4 and MetaTrader 4 - MQL4 programming forum #8
  2. I understood completely and showed you the problem lines and highlighted the problems.
  3. You can't find a solution even when someone shows it to you. Your problem. Step away from the keyboard and go to Freelance.
  4. I did help you. You won't learn.
  5. You be rude and expect people to help you? You be rude and expect us to waste our time when you won't even try.
12
To add comments, please log in or register