Indicator timeframes

 

Hi guys,


So I run an indicator that I have written on the hourly timeframes and it gives me fairly reliable signals. However I have noticed that it often notifies me quite late because it waits for the candle to close, which it only does every hour. And by that point the price might be 20 PIPs above the signal point and therefore I'm late to the party. I was wondering if I were to run the indicator on the 15min but have the MA lines set to the hourly timeframes if this would give me a signal earlier than it would running on the hourly charts. Is it just that simple? Or am I missing something...?


Thanks for your help.

 
  1. Your indicator should be processing bar zero and show you a forming signal. If it isn't fix it.
              How to do your lookbacks correctly.
  2. Looking at the current candle instead of waiting means you may have an intermittent signal.
 
whroeder1:
  1. Your indicator should be processing bar zero and show you a forming signal. If it isn't fix it.
              How to do your lookbacks correctly.
  2. Looking at the current candle instead of waiting means you may have an intermittent signal.

Thanks, what do you mean by an intermitent signal? Do you mean that it will keep triggering as the price bounces above and below the line? If so, I have a variable that sets itself when triggered once and only unsets itself when the exit signal is generated. That should surely stop that?

 
So you will have triggered a buy signal, but at end of the bar, if price never closed above your line, do you have a bogus buy signal or the sell signal?
 

I see what you mean. My Buy and Sell signals aren't the same MA line, there's a buffer in between them. So I wouldn't necessarily have that problem, but say the price crosses the Buy signal at 5 minutes past the hour, but the candle doesn't close until 55 minutes later. Even if for the whole of that time the price was above the Buy line, I wouldn't know about it until it could possibly have already gained a lot of ground. That's why I want to know if I can get more frequent signals based at the same levels. Because if I run the indicator as it is on a lower timeframe the MA is obviously in a different place.

Also the code you directed me to looks a little different to mine, but it might be the same, just written slightly differently. Is:


int limit = rates_total - prev_calculated;

for(int i = limit-1; i >= 0; i--)
  {
  if (i >= MathMin(5000-1, rates_total-1-50)) continue; 

return(rates_total);

Similar to:

 for(int iBar = Bars-1-MathMax(lookback, prev_calculated); iBar >= 0; --iBar){
      // Timeseries and Indicators Access uses index=iBar
      https://docs.mql4.com/series
   }
   return rates_total-1; // Recalculate current bar next tick.

Or am I completely off?

 
DrBeardface: if I can get more frequent signals based at the same levels.

Also the code you directed me to looks a little different to mine, but it might be the same, just written slightly differently. Is:

  1. Code it like the lower, and bar zero will have a signal as soon as possible.
  2. The upper "version" assumes a look back of 50. It does not recalculate bar zero, bogus. Limit becomes zero and the loop doesn't run. If you remove the minus one, then first time limit=rates_total, array exceeded. That is why I return rates_total-1, so no test for that is necessary.
 

So can I just swap it out or do I have to make other changes? I'm assuming that I keep thebit that says

if (i >= MathMin(5000-1, rates_total-1-50)) continue;
 
What part of "Code it like the lower ..." upper "does not recalculate bar zero" was unclear?
 
The part where one is just a for loop and the other is a for loop and an if statement...
 
DrBeardface: The part where one is just a for loop and the other is a for loop and an if statement...

Do you mean the lower SRC section with "just a for loop" and the upper SRC section with a "for loop and an if statement...

Again, what part of "Code it like the lower" was unclear?

 

I'm just checking that after that line of code it goes straight into the conditions for the buy/sell signals.

Reason: