Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Ayumi, Quad, PeWi), 488 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 7 1 2 3 4 5 6 7
Precise AssetMarketStart/End #485280
02/16/22 13:47
02/16/22 13:47
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
It is a reality that the market in MT4/5 closes at 16:59 EST each day (at 16:55 on Fri); + spreads widen towards market close (in fx)- so I want to "close" the hour 3-5 min earlier.

Yet, using AssetMarketEnd=1657, Zorro "rounds" the time to the nearest BarPeriod and takes the tick of 17:00 as the close for the last candle.

I find value in using the bars ending at normal hour boundaries and don't want to use BarOffset.

So, it would be great if candle prices were limited precisely by the time specified as AssetMarketEnd - both in Test and in Live, and no trades were allowed past the time specified.

Thank you.


Last edited by Zheka; 02/16/22 14:24.
Re: Precise AssetMarketStart/End [Re: Zheka] #485285
02/16/22 23:09
02/16/22 23:09
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
When using several assets:
Code
function run() {
	
	set(LOGFILE);
	NumYears=1;
	
       BarPeriod=30;
	
BarMode = BR_ASSET;

	  asset("EUR/USD");	  
	
	  vars prcI= series(priceC(0));	
	   printf("# FXcls=%.5f,markend=%i",prcI[0],AssetMarketEnd);

			
	asset("WS30");	
	
	vars prc= series(priceC(0));	
	printf("# WScls=%.2f,markend=%i",prc[0],AssetMarketEnd);
	
	
	asset("XAUUSD");	
	
	vars prc= series(priceC(0)); vars Opn = series(priceO(0));
	
	printf("# XAU_cls =%.2f,opn=%.2f,markend=%i",prc[0],Opn[0],AssetMarketEnd);	
} 
i see the following output:
Quote
[189: Thu 22-01-06 21:00] (1788.20) FXcls=1.12912,markend=1656 WScls=36254.00,markend=1658 XAUcls =1788.20,opn=1789.34,markend=1657

[190: Thu 22-01-06 21:30] (1789.81) FXcls=1.12926,markend=1656 WScls=36279.00,markend=1658 XAUcls =1789.81,opn=1788.20,markend=1657

[191: Thu 22-01-06 22:00] (1790.81) FXcls=1.12985,markend=1656 WScls=36279.00,markend=1658 XAUcls =1789.81,opn=1788.20,markend=1657

[192: Thu 22-01-06 22:30] (1790.81) FXcls=1.12970,markend=1656 WScls=36279.00,markend=1658 XAUcls =1789.81,opn=1788.20,markend=1657

[193: Thu 22-01-06 23:00] (1790.81) FXcls=1.12963,markend=1656 WScls=36279.00,markend=1658 XAUcls =1789.81,opn=1788.20,markend=1657

[194: Thu 22-01-06 23:30] (1791.17) FXcls=1.12975,markend=1656 WScls=36313.00,markend=1658 XAUcls =1791.17,opn=1789.30,markend=1657


The last candle of the day on EUR/USD has a close price from the tick at 1700 EST (with AssetMarketEnd=1656), BUT on WS30 and XAU - it is from 1630EST (2130 UTC) - while AssetMarketEnd are 1658 and 1657.

Re: Precise AssetMarketStart/End [Re: Zheka] #485287
02/17/22 07:40
02/17/22 07:40
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
The market hours are not rounded, but evaluated at the end of any bar. That's why you got the 17:00 close price. I don't know the reason of 16:30 prices though - maybe that asset simply has no 17:00 prices. For closing a 17:00 candle with the 16:57 price, use a tick function and set the NOPRICE flag at the market end time. I don't want Zorro to do that automatically because it would cause incorrect candles behind the user's back.

Re: Precise AssetMarketStart/End [Re: Zheka] #485292
02/17/22 15:59
02/17/22 15:59
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
Zorro is inconsistent in how it treats "times": with EndMarket=1700 (and BR_MARKET) the last bar of the day will have a timestamp of 1700 - as expected and which is THE convention for most "closing times" out there.

BUT with EndWeek=51700, - behind the unsuspecting user's back - the last bar on Friday will have a timestamp of 1600 - which is the behavior above with WS/XAU. I can bet most users are not aware of this "nuance".


Ideally, "what you set is what you get", i.e. setting AssetMarketEnd=1658, would indeed only use prices until that moment AND prevent trades opening past that time.

The situation is common and real. There has to be an in-built mechanism of how to deal with it. This can most efficiently be done at the "engine" level; switching to tick processing on the user side isn't.

I tried but could not think of a case where sticking to what's specified by AssetMarketEnd would "cause incorrect candles behind user's back" (pls give an example).

So, please consider.

Re: Precise AssetMarketStart/End [Re: Zheka] #485297
02/19/22 11:23
02/19/22 11:23
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
That would be indeed an inconsistency. - Update: Time periods usually go from start up to, but not including the end. So there is no such inconsistency, but if you think you found one, please contact Support with all details.

Re: Precise AssetMarketStart/End [Re: Zheka] #485300
02/19/22 15:04
02/19/22 15:04
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
EndWeek=1700 ends the week at 1600. Is that expected?

While the tick of 1700 - very technically - is indeed the start of the new hour, that's in conflict even with Zorro's convention on "time spans": 17:00(00!) is assumed to be the "end" time for the bar - "up to and including", not the beginning.

Then why would a bar spanning 11:00pm - 12:00 pm be considered part of the next day??


Is time treatment for AssetMarketEnd similar to EndWeek?

If yes, then "EST: 0930-1600" is a misleading example you give in the manual - this would skip a most crucial BarPeriod of a trading day.


Coming back to the OP: will there be a investigation/fix for how AssetMarket/ BR_ASSET functionality work with several assets?
Besides inconsistent "market closes"/series shifting, trades also trigger in "off-market" hours...

Re: Precise AssetMarketStart/End [Re: Zheka] #485301
02/19/22 15:15
02/19/22 15:15
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
I think I can answer that: Yes, AssetMarketEnd, EndMarket, and EndWeek are all treated the same and yes, BR_ASSET works with several assets. I'll forward that remark about the misleading example.

Re: Precise AssetMarketStart/End [Re: Zheka] #485302
02/19/22 17:44
02/19/22 17:44
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
What's the benefit or necessity of treating 00:00 as "inclusive of" for bars, but "exclusive of" for market hours/days, etc? Why would day(0) return "next day" for a bar spanning 2000-0000?

As for BR_ASSET:

1) can you pls explain the log in OP, specifically, the price series for EUR/USD.

2) this script:
Code
function run() {
	
	set(LOGFILE);
	NumYears=1;
		
        BarPeriod=15;
	
	BarZone=ET;
		
        BarMode = BR_ASSET;

        MaxLong=1; 

	asset("EUR/USD");	  
	  
	        AssetMarketZone=ET;	
		AssetMarketStart = 0930;
		AssetMarketEnd = 1601;
	 
	  vars prcI= series(priceC(0));
	
	   printf("# cls1=%.5f,mark1end=%i",prcI[0],AssetMarketEnd);

			
	asset("SPY");	
	
	AssetMarketZone=ET; 
	AssetMarketStart = 0930;
	AssetMarketEnd = 1601;	
	
	vars prc= series(priceC(0));
	
	printf("# cls2=%.2f,mark2end=%i",prc[0],AssetMarketEnd);
		
	LifeTime=10;
	if (ltod(ET,0)>AssetMarketEnd)
	  if (prc[0]>prc[1]) 
           enterLong();		
}
gives this output:
Quote
[565: Mon 22-01-10 21:00] (465.55) FXcls=1.13263,markend=1601 WScls=465.55,markend=1601

[566: Mon 22-01-10 21:15] (465.42) FXcls=1.13263,markend=1601 WScls=465.55,markend=1601
[SPY::L56606] Long 1@465.47 x at 21:15:00

[567: Mon 22-01-10 21:30] 0.0850 +0.0850 1/0 (465.61) FXcls=1.13263,markend=1601 WScls=465.55,markend=1601
The trades can also expire outside market hours.

Re: Precise AssetMarketStart/End [Re: Zheka] #485508
03/18/22 15:30
03/18/22 15:30
Joined: Jul 2017
Posts: 784
Z
Zheka Offline OP
User
Zheka  Offline OP
User
Z

Joined: Jul 2017
Posts: 784
The log above shows a trade taken at 1615ET - past AssetMarketEnd=1601. The manual says that BR_ASSET prevents series shifting AND trade signals outside market hours.

BR_ASSET also does not prevent trade expiry (from LifeTime or TradeExitDate) outside market hours.

Can this pls be looked at?




Last edited by Zheka; 03/18/22 15:31.
Re: Precise AssetMarketStart/End [Re: Zheka] #485509
03/18/22 17:15
03/18/22 17:15
Joined: Apr 2008
Posts: 586
Austria
Petra Offline
Support
Petra  Offline
Support

Joined: Apr 2008
Posts: 586
Austria
Looked at what?

Page 1 of 7 1 2 3 4 5 6 7

Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1