Volume Weighted Hull MA

 

Is it possible? 

Is the code compatible?

 

I'm just going to post my entire code and hopefully we can get this figured out. My head hurts.

It compiles, but it doesn't show on my chart. Idk what gives. You'll need to download and install the patched SmoothAlgorithms.mqh file floating around in the forums in order to compile it. The mqh file in the codebase has errors.


Someone was able to get it to work in trading view, so I know it's possible..

[censored due to market potential of being the only Hull VWMA on the MT5 market, but explanation below.]

Try to ignore my experimentations with wacky price combinations..

 
Nicholas C Weber #: It compiles, but it doesn't show on my chart. Idk what gives.
   for(bar=0; bar<rates_total; bar++)
     {
      sum1=0;
      sum2=0;
      for(int ntmp=0; ntmp<int(n1); ntmp++)
        {
         if(VolumeType==VOLUME_TICK) vol=long(tick_volume[bar+ntmp]);
  1. When bar approaches rates_total, you access beyond rates_total, array exceeded, indicator terminated, nothing displayed.

  2. Why are you recalculating all bars each tick?

  3. Do your lookbacks correctly #9#14 & #19. (2016)

 
I got it to work, but now it just appears at the bottom of the chart where the volume bars are. I think I need to start from scratch again. I was copying code from a codebase VWAP_close indicator and converting it into my needs, but I'll just do what I hope will work. If someone else can get that code to work, lemme know! :D
 
I figured it out. I was using too many buffers. I needed to be using a VWMA with the Hull math, not LWMA Hull math buffers using the VWMA period one value as price. oops! I'm removing the code now. But just know that you can use the Hull Math initializing a half_period and a Square_root Period based on the used period and create 3 buffers, period, half period, sqrt period. a fourth buffer needs to be used to subtract first two period buffers and use that sum as the price for the sqrt period buffer. You can apply this method to any MA type, I'd think. SmoothAlgorithms.mqh finclude is probably your best bet to get right MA types to work.
Reason: