Help Coding with iCustom (Better Volume)

Post Reply
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Help Coding with iCustom (Better Volume)

Post by theforexedge »

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;
                              }
                           
                        }
                      }
                  }
            }  
You do not have the required permissions to view the files attached to this post.
User avatar
tomele
Administrator
Posts: 1208
Joined: Tue May 17, 2016 3:40 pm
Location: Germany, Forest of Odes, Defending the Limes

Help Coding with iCustom (Better Volume)

Post by tomele »

Hi.

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

Cheers.
Happy pippin, Thomas :-BD

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so.
(Mark Twain)

Keep the coder going: Donate
theforexedge
Trader
Posts: 220
Joined: Thu Apr 26, 2012 10:31 pm
Location: Torquay

Help Coding with iCustom (Better Volume)

Post by theforexedge »

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
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Help Coding with iCustom (Better Volume)

Post by SteveHopwood »

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:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
Post Reply

Return to “Coders Hangout”