NexusFi: Find Your Edge


Home Menu

 





Relative Volume for MC


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one bmtrading9 with 4 posts (0 thanks)
    2. looks_two ABCTG with 2 posts (1 thanks)
    3. looks_3 Jura with 1 posts (2 thanks)
    4. looks_4 rolandw85 with 1 posts (0 thanks)
    1. trending_up 5,505 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 bmtrading9 
Atlanta, GA, USA
Market Wizard
 
Experience: Advanced
Platform: MC and Jigsaw
Trading: ES, MES
Posts: 1,824 since Mar 2013
Thanks Given: 3,001
Thanks Received: 2,159

Would anyone please take a look at this code, this code seems to work properly on historical data but not in real time. This is relative volume indicator works on min chart only.

@ABCTG any help?

 
Code
// __RACumVol - Average Cumulative Volume at this time for the last X days. 
// Must be used on minute-type intraday charts 
	 
Inputs:  
 DaysToAvg(14); 
 
Variables:  
    BarInDay(0), 
	BarsToday(0), 
	CumVolToday(0), 
	DayNumber(-99), 
	BarsPerDay(26),  
	TotCumVol(0), 
	AvgCumVol(0), 
	VolPercentile(0); 
 
 
// Declare the array.  Rows = number of days to average; columns = number of bars per day. 
// Add one to rows to avoid using row 0. 
IF BarType = 1 then 
BEGIN 
	value1 = TimeToMinutes(SessionEndTime(0,1)) - TimeToMinutes(SessionStartTime(0,1)); 
	value1 = value1/BarInterval; 
	 
	If FracPortion(value1) = 0 then 
		BarsPerDay = value1 
	else 
		BarsPerDay = value1 + 1 - FracPortion(value1); 
 
//Arrays: VolArray[22,405] (0); // Note max bars of 405 ( 1 minute 9:30 - 16:15 ) 
Arrays: VolArray[22,495] (0); // Note max bars of 495 ( 1 minute 8:00 - 16:15 )
 
If Date<>Date[1] THEN  
BEGIN	 
 
    //If we've passed day 20, then move everybody back a seat. 
	// All of day 2's data in the array goes into day 1, day 3 into day 2, etc, up through 21 into day 20.	 
	IF DayNumber+1 > DaysToAvg +1 THEN  
	BEGIN 
		For Value1=1 to DaysToAvg Begin; {Outer loop - one for each day, 1-20 + current day }	        
           For Value2 = 1 to BarsPerDay Begin; {Inner Loop - one for each bar in a day, 1-26} 
              VolArray[Value1,Value2] = Volarray[Value1+1 ,Value2]; 
	   	   End; 
		End; 
 
	END;	 
 
    // Start/Increment Day Counter.  It never goes above 21. 
	IF Daynumber = -99 THEN DayNumber = 1 {Start of first full day on the chart} 
	ELSE DayNumber = MinList(DayNumber+1,DaysToAvg+1) ;        {Start of a subsequent day, never goes above 21}	 
 
	// Reset cumulative daily bar and volume counters, since on first bar of a new day. 
	CumVolToday = 0; 
	BarsToday = 0;	 
	 
	// Clear out array row number (days to average + 1) for today's data. Previously moved it into day 20 in the array. 
    IF DayNumber >= DaysToAvg  + 1 THEN  
		For Value2 = 1 to BarsPerDay Begin 
			VolArray[DaysToAvg  + 1, Value2] = 0; 
		End;		 
END; {tasks for first bar of each day} 
 
IF Daynumber <> -99 THEN  
BEGIN	 
 
	// Increment bar and volume counters. 
	BarsToday = BarsToday + 1; 
	CumVolToday = CumVolToday + Volume; 
 
	// Store today's cumulative volume into the array, in the column for this bar. 
	VolArray[DayNumber, BarsToday] = CumVolToday; 
END; 
 
// Now calculate the 20-day cumulative average volume through this bar, if we have enough data. 
If Daynumber > DaysToAvg THEN  
BEGIN 
		TotCumVol = 0; 
	    // Add up the cumulative volume through this time for each of the past 20 days. 
		For Value3 = 1 To DaysToAvg Begin 
			TotCumVol = TotCumVol + VolArray[Value3, BarsToday]; 
		End;		 
		// And divide it by the number of days to get the average cumulative daily volume through this time of day. 
		AvgCumVol = IntPortion(TotCumVol / DaysToAvg); 
		// Now compare today's ccumulative volume to the average. 
	    VolPercentile = IFF(AvgCumVol > 0, CumVolToday *100 / AvgCumVol, 0); 
	     
	    Plot1(VolPercentile-100,"VPctAvg");  
	    Plot2(0,"100%"); 
	     
	    //plot1(value1, "TotalCumVol");
	    //plot1(VolPercentile, "AvgCumVol");
	    //plot1((TotCumVol-CumVolToday)/AvgCumVol, "CumVolToday");
END; 
END;


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


bmtrading9,

what does your debugging show i.e. what happens within the code on realtime bars versus live data? Looking into this will be the first step in tracking the problem down.

Regards,

ABCTG


Follow me on X Reply With Quote
Thanked by:
  #4 (permalink)
 bmtrading9 
Atlanta, GA, USA
Market Wizard
 
Experience: Advanced
Platform: MC and Jigsaw
Trading: ES, MES
Posts: 1,824 since Mar 2013
Thanks Given: 3,001
Thanks Received: 2,159


ABCTG View Post
bmtrading9,

what does your debugging show i.e. what happens within the code on realtime bars versus live data? Looking into this will be the first step in tracking the problem down.

Regards,

ABCTG

I have to find it out how to debug in MC, If you plot it it will plot perfectly on historical min data but if you watch this indicator real time, plot is way different worst part is I don't even remember where I got this code, it looks like TS code.

Sent from my SAMSUNG-SM-G900A using Tapatalk


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
Jura's Avatar
 Jura   is a Vendor
 
Posts: 775 since Apr 2010
Thanks Given: 2,352
Thanks Received: 691


bmtrading9 View Post
I have to find it out how to debug in MC, If you plot it it will plot perfectly on historical min data but if you watch this indicator real time, plot is way different worst part is I don't even remember where I got this code, it looks like TS code.

It may be TS code, but none of the statements contain something that isn't possible in MultiCharts.

What are your indicator settings in real time? From your description, I suspect you're using the 'Update on every tick' setting enabled. With that option, the indicator processes every real time tick. Since MultiCharts indicators only calculate on the close of each bar on historical data, in effect your indicator will calculate differently on historical data (once per bar) than on real-time data (numerous times per bar).

I would disable the 'Update on every tick' option and then see how the behaviour in real time is. Here's more on that setting: Wiki: Update on every tick.


Reply With Quote
Thanked by:
  #6 (permalink)
 bmtrading9 
Atlanta, GA, USA
Market Wizard
 
Experience: Advanced
Platform: MC and Jigsaw
Trading: ES, MES
Posts: 1,824 since Mar 2013
Thanks Given: 3,001
Thanks Received: 2,159


Jura View Post
It may be TS code, but none of the statements contain something that isn't possible in MultiCharts.

What are your indicator settings in real time? From your description, I suspect you're using the 'Update on every tick' setting enabled. With that option, the indicator processes every real time tick. Since MultiCharts indicators only calculate on the close of each bar on historical data, in effect your indicator will calculate differently on historical data (once per bar) than on real-time data (numerous times per bar).

I would disable the 'Update on every tick' option and then see how the behaviour in real time is. Here's more on that setting: Wiki: Update on every tick.

Thanks, that might be it I will verify it on Monday

Sent from my SAMSUNG-SM-G900A using Tapatalk


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 bmtrading9 
Atlanta, GA, USA
Market Wizard
 
Experience: Advanced
Platform: MC and Jigsaw
Trading: ES, MES
Posts: 1,824 since Mar 2013
Thanks Given: 3,001
Thanks Received: 2,159


Jura View Post
It may be TS code, but none of the statements contain something that isn't possible in MultiCharts.

What are your indicator settings in real time? From your description, I suspect you're using the 'Update on every tick' setting enabled. With that option, the indicator processes every real time tick. Since MultiCharts indicators only calculate on the close of each bar on historical data, in effect your indicator will calculate differently on historical data (once per bar) than on real-time data (numerous times per bar).

I would disable the 'Update on every tick' option and then see how the behaviour in real time is. Here's more on that setting: Wiki: Update on every tick.

Nope, didn't solve it. Same issue.

Sent from my SAMSUNG-SM-G900A using Tapatalk


Follow me on X Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #8 (permalink)
 sage08 
Singapore
 
Experience: Advanced
Platform: Multicharts
Trading: ES
Posts: 2 since Jul 2014
Thanks Given: 0
Thanks Received: 0

I have the same issue. Ticking off update every tick does not help. Can anyone help here?


Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

sage08,

please describe the exact issue you are having and the explain the chart setup you are applying this indicator to (i.e. symbol, interval, amount of history etc. everything that would be required to reproduce what you are seeing).

Regards,

ABCTG


sage08 View Post
I have the same issue. Ticking off update every tick does not help. Can anyone help here?


Follow me on X Reply With Quote
  #10 (permalink)
 rolandw85 
London
 
Experience: Intermediate
Platform: Tradestation
Trading: equities, options
Posts: 12 since Nov 2019
Thanks Given: 0
Thanks Received: 6


hey did you ever get a working RVOL?


Reply With Quote




Last Updated on February 21, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts