Differences in Volume History and Result, why?

Posted By: TedMar

Differences in Volume History and Result, why? - 06/21/20 22:22

Hi, i try find out why my result of volume is different from history in same TF, maybe any one can help ?
Data history is SPY t6 in 1 min time frame include Vol per Bar.
in Zorro History Viewer are Vol prints Volume O.K.
SPY data History Download is available here.

Example code
Code
function run() 
{
		  set(LOGFILE+PLOTNOW);		 
		
		  Verbose = 3;
		  TickFix = 1;   
                  StartDate = 20200616;
                  EndDate = 20200617;
			  
		  BarPeriod = 1;  // same as History (RAW)
		
                  asset("SPY");

                       // vars Prices = series(priceClose()); 
		   
		vars Vol = series(marketVol());
		
                plot("MarketVol",Vol,BARS|NEW,BLUE);  
		
}




for Example result, check attachment, them display difference between History and Result.
Anyone know a way to resolve this problem?



Attached File
2020-06-21 23_46_53-Window.png  (116 downloads)
Posted By: ozgur

Re: Differences in Volume History and Result, why? - 06/24/20 06:53

What does logfile say?
Posted By: TedMar

Re: Differences in Volume History and Result, why? - 06/24/20 08:42

Originally Posted by ozgur
What does logfile say?

If u remove TickFix, u get almost right Volume.
I connect already support , and he wrote me :

"if you do not see certain data in the log depending on the TickFix, then obviously two timestamps fall into the same bar. This can also happen without TickFix if the timestamps are irregular."

i mean this is a Bug, its bad when Volume disappear. TimeStamps in History data are clean and every 1 min regular.

without TickFix , Us Session open Price and Volatility at 9:30:00,000 are in previous Bar. I not understand why.. i manual "BarPeriod" i found this

Quote

In [Test] mode, bar generation is based on the UTC time stamps of ticks in the historical price data. All ticks that fall in the bar period contribute to the bar. For instance, a 10-minute bar ending at 12:00 contains all ticks with timestamps from 11:50:00.000 until 11:59:59.999. If the tick covers several prices, its time stamp should be from its close price. If historical time stamps are from the open or the middle price instead, you can use the TickFix variable for adjusting them. In [Trade] mode, bar generation is based on UTC time from the PC clock, not on the broker's server time for avoiding sync problems by connection interruptions and Internet lag.



in example ScreenShot i tryed count Volume from 1m History to 5min BarPeriod. Count function is from manual "marketVol()" Exampele
If i add 5x 1 Min Stamps i get different values to log. Maybe i count wrong..?

Attached File
2020-06-24 09_27_27-Window.png  (103 downloads)
Posted By: AndrewAMD

Re: Differences in Volume History and Result, why? - 06/24/20 12:47

Did you notice that all of your volume is multiples of five? Your last M1 tick is getting multiplied by five. That's because the other four volume data points are being thrown out. grin

Also, your volumeSum function is creating a five-minute lag.
Posted By: TedMar

Re: Differences in Volume History and Result, why? - 06/24/20 13:24

aha Andrew thank u for info, but how is right code to get true result?
Posted By: AndrewAMD

Re: Differences in Volume History and Result, why? - 06/24/20 13:34

In your first example, you plotted bars, but the second example printed numbers, which was far more useful.

Revise the first example to print volume numbers. This will give you some clues on what Zorro is doing behind the scenes.

Then play around with TickFix a bit more.
Posted By: TedMar

Re: Differences in Volume History and Result, why? - 07/04/20 23:32

notice, after many Mails with support ..https://manual.zorro-project.com/new.htm

Quote
Zorro 2.25 (current release) list of bugs
Under some circumstances the 1-minute volume by marketVol was not averaged, but taken from the most recent volume (fixed in 2.28.6).
© 2024 lite-C Forums