Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 770 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 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: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
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: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
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: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
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: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
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: 784
Z
Zheka Offline
User
Zheka  Offline
User
Z

Joined: Jul 2017
Posts: 784
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: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
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 | 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