Trouble finding max (or highest) volume of past N bars  [SOLVED]

Questions about MultiCharts and user contributed studies.
ProtoTrader
Posts: 7
Joined: 27 Nov 2018

Trouble finding max (or highest) volume of past N bars

Postby ProtoTrader » 13 Oct 2019

I would like to plot a histogram indicator that shows volume as a percentage of the maximum volume seen during the past N bars.

I created the code below but it is not working. It just plots a 0 line.

The problem seems to be finding the maximum volume during the lookback period. Its returning 0, but I am not sure why.

Please help me to revise my code.

Code: Select all

inputs: Length( 10);
Vars: VolPrcnt(0);


If Lowest (Volume, Length) <> 0 Then
VolPrcnt = Volume / Highest (Volume, Length);

Plot1( VolPrcnt, "VP" )

User avatar
TJ
Posts: 7742
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Trouble finding max (or highest) volume of past N bars

Postby TJ » 13 Oct 2019

What is the instrument?
What is the chart resolution?

Maybe indirectly related,
Look up the definition and usage example of the following keywords

Volume
Ticks

ProtoTrader
Posts: 7
Joined: 27 Nov 2018

Re: Trouble finding max (or highest) volume of past N bars

Postby ProtoTrader » 13 Oct 2019

Instrument is ES, resolution is 30 min bars. Standard volume indicator (that MC shipped with) displays fine.

Are you saying that the "Highest" function does not work on volume data and only on price data?

ProtoTrader
Posts: 7
Joined: 27 Nov 2018

Re: Trouble finding max (or highest) volume of past N bars  [SOLVED]

Postby ProtoTrader » 15 Oct 2019

MC support was able to solve my issue. My code was fine, it was a hidden setting. They said: Format Instruments -> Settings Tab. Build Volume on: Tick Count.

I'm not sure if its my data source that required this setting to be changed. I am using data imported from ASCII.


Return to “MultiCharts”