Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (dBc), 17,971 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Unable to close MT4 positions from a previous Zorro session. [Re: Grant] #485749
04/19/22 07:24
04/19/22 07:24
Joined: Jul 2017
Posts: 787
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 787
Re-read the manual on enter/exit commands: trading is disabled during the lookback period, and the first bar after the lookback is StartBar, not 1.

So, remove Bar>1 ( or substitute it with ( if (!is(LOOKBACK)) or Bar>StartBar) and remove quit().

Re: Unable to close MT4 positions from a previous Zorro session. [Re: Zheka] #485764
04/20/22 13:43
04/20/22 13:43
Joined: Aug 2017
Posts: 311
Netherlands
G
Grant Offline OP
Senior Member
Grant  Offline OP
Senior Member
G

Joined: Aug 2017
Posts: 311
Netherlands
OK, thanks a lot for this, very insightful.

I thought that the LOOKBACK period only had an impact in TESTMODE with a specific StartDate.
So, in TRADEMODE, this basically means that it's best to only re-start Zorro during the weekend when it's really needed, because live trading is always idle for the length of the LOOKBACK period, even when StartDate is 'NOW'.

Is this correct?

Re: Unable to close MT4 positions from a previous Zorro session. [Re: Grant] #485769
04/20/22 14:41
04/20/22 14:41
Joined: Jul 2017
Posts: 787
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 787
In Live, Lookback history is back-filled - from existing data and/or freshly loaded from the broker. So trades are allowed from the first complete bar onward. Not sure how this works with StartDate=NOW.

Last edited by Zheka; 04/20/22 14:41.
Re: Unable to close MT4 positions from a previous Zorro session. [Re: Zheka] #485770
04/20/22 14:50
04/20/22 14:50
Joined: Aug 2017
Posts: 311
Netherlands
G
Grant Offline OP
Senior Member
Grant  Offline OP
Senior Member
G

Joined: Aug 2017
Posts: 311
Netherlands
Originally Posted by Zheka
Not sure how this works with StartDate=NOW.


Based on what I read in the manual, it seems best not to define StartDate at all in TRADEMODE.

Quote
StartDate = NOW sets the start date to the current day, and executes the run function in [Trade] mode immediately after the lookback period, regardless of the current time. Useful for strategies that do not run permanently, but are only started for modifying a portfolio.
- StartDate = 0 (default) starts the simulation with NumYears before the current year.

Last edited by Grant; 04/20/22 15:23.
Re: Unable to close MT4 positions from a previous Zorro session. [Re: Grant] #485772
04/20/22 16:33
04/20/22 16:33
Joined: Jul 2017
Posts: 787
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 787
StartDate is 'ignored' in Live,unless set to NOW.

Last edited by Zheka; 04/20/22 16:34.
Re: Unable to close MT4 positions from a previous Zorro session. [Re: Zheka] #485774
04/20/22 17:42
04/20/22 17:42
Joined: Aug 2017
Posts: 311
Netherlands
G
Grant Offline OP
Senior Member
Grant  Offline OP
Senior Member
G

Joined: Aug 2017
Posts: 311
Netherlands
I see, so that NOW setting in TRADEMODE did more harm than good.
I will log some details to be sure that things run correct right from the start.

I appreciate your help Zheka.

Page 3 of 3 1 2 3

Moderated by  Petra 

Gamestudio download | 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