stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Help Coding with iCustom (Better Volume)
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5284
Page 1 of 1
Author:  theforexedge [ Thu Sep 14, 2017 6:18 pm ]
Post subject:  Help Coding with iCustom (Better Volume)

Hi.

Just wondering if anyone can cast their eye over my attempt at adding this Better Volume indicator into an EA for testing?

I'm trying to look back the past twenty bars to see if there is any climax high / low volume and then save it to a GlobalVariable. From what I can see the indicator buffer is 7, but for some reason when I run the for-loop it will only see the bar 0 and 1 and doesn't scan through the last 20 bars (TrendVolumeLookBackCandles) as needed!.

Apologies :smile: if my coding isn't great but I'm still learning from analysing Steve's shell code.

Indicator attached...

Thanks, JP

Code: Select all

if (UseTrendVolume)
            {
               static datetime oldTrendVolumeBarTime = 0;
           
                 if (oldTrendVolumeBarTime != iTime(Symbol(), VolumeIndicatorTimeFrame, 0))
                 {
                  oldTrendVolumeBarTime = iTime(Symbol(), VolumeIndicatorTimeFrame, 0);
                  
                  TrendVolumeStatus = volumenosignal;
               
                     for (int vv = 0; vv <= TrendVolumeLookBackCandles; vv++)
                     { 
                     trendvolumevalue  = iCustom(Symbol(), TrendVolumeTradingTimeFrame, "BetterVolume",7,vv);
                     
                     if(!CloseEnough(trendvolumevalue,EMPTY_VALUE))
                        {
                           if(trendvolumevalue == 1)     TrendVolumeStatus = volumeclimaxhigh; 
                           if(trendvolumevalue == 2)     TrendVolumeStatus = volumeneutral;
                           if(trendvolumevalue == 3)     TrendVolumeStatus = volumelow;
                           if(trendvolumevalue == 4)     TrendVolumeStatus = volumehighchurn; 
                           if(trendvolumevalue == 5)     TrendVolumeStatus = volumeclimaxlow; 
                           if(trendvolumevalue == 6)     TrendVolumeStatus = volumeclimaxchurn; 
         
                           if (TrendVolumeStatus == volumeclimaxhigh)
                              {
                                 TrendVolumeTradeTrigger = volumetradesell;
                                 GlobalVariableSet(TrendVolumeTradeTriggerGvName,1);
                                 break;
                              }
                           if (TrendVolumeStatus == volumeclimaxlow)
                              {  
                                 TrendVolumeTradeTrigger = volumetradebuy;
                                 GlobalVariableSet(TrendVolumeTradeTriggerGvName,2);
                                 break;
                              }
                           
                        }
                      }
                  }
            }  
Author:  tomele [ Thu Sep 14, 2017 7:04 pm ]
Post subject:  Help Coding with iCustom (Better Volume)

Hi.

Open the data window in MQ4 and observe the buffers of your indi. You will understand then why it doesnt work.

Cheers.
Author:  theforexedge [ Thu Sep 14, 2017 8:29 pm ]
Post subject:  Help Coding with iCustom (Better Volume)

Thomas

Ah! yes thanks...I increased the indicator buffer loop z in DoShow() from 3 to 20.. :smile:

Thanks for pointing me in the right direction..

JP
Author:  SteveHopwood [ Fri Sep 15, 2017 12:33 am ]
Post subject:  Help Coding with iCustom (Better Volume)

theforexedge ยป Thu Sep 14, 2017 6:18 pm[/url]Apologies :smile: if my coding isn't great but I'm still learning from analysing Steve's shell code.
Fantastic to see you peering under the bonnet.

Keep at it tiger. You will never regret doing so. :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
All times are UTC Page 1 of 1