Advice for deciding which way price is currently?

 

Any advice on deciding this?‌

Best I can come up with i:

      total = 0;
      double div = 1;
      for(shift= ArraySize(close) - 1; shift >= 1; shift--)
      {
         total += (close[shift] - close[shift - 1]) / MathPow(div, 2.0);
 
         div++;
      }
  
      if (total > 0)
         direction = true;
      else
         direction = false;

What I need is a way to delete the noise in the close price a‌rray, any ideas?

Thanks.‌

s‌

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Price Constants - Reference on algorithmic/automated trading language for MetaTrader 5
 
paulgriffiths:

Any advice on deciding this?‌

Best I can come up with i:

What I need is a way to delete the noise in the close price a‌rray, any ideas?

Thanks.‌

s‌


I can use this for removing some of the noise:

      total = 0;
      double div = 1;
      for(shift= ArraySize(close) - 1; shift >= 4; shift--)
      {
         total += ((close[shift] - close[shift - 2]) + (close[shift - 1] - close[shift - 3]) + (close[shift - 2] - close[shift - 4])) / MathPow(div, 2.0);
 
         div++;
      }
  
      if (total > 0)
         direction = true;
      else
         direction = false;

Problem I'm having is it keeps changing from up to down or down to up way to quickly.

Slightest change in price change changes the direction variable.

There must be a better way to smooth it out?

Cheers‌.

 ‌

 

Why not use Sum of X previous close prices then divide the new price on X ...

This will smooth the new price and minimize the noise.

As much as X is getting bigger, the output will be less sensitive to noise.

If you search about Noise reduction in Digital Signal/Image Processing, you may

f‌ind many ideas.

Reason: