Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by howardR. 04/28/24 09:55
basik85278
by basik85278. 04/28/24 08:56
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Quad, AndrewAMD), 722 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
Training with command line parameters #487915
11/13/23 11:59
11/13/23 11:59
Joined: Nov 2023
Posts: 1
C
ChaosTrader Offline OP
Guest
ChaosTrader  Offline OP
Guest
C

Joined: Nov 2023
Posts: 1
Hi,
I want to train a script with different end dates by using a batch file and passing through the Enddate as a -i parameter. In the script, I replaced the end date value with Command[0].
Training is getting startet, but obviously the script sets the Endate to 0 instead of using the passed value of e.g. 20230930. For -run it is working perfectly as expected and the passed dates are being used. I feel that at the point where the training starts, the passed parameters are not yet initialized.
I am using Version 2.56 with S License.

It is a known bug or did I miss something in the script/batch?

Best regards,
CT

Re: Training with command line parameters [Re: ChaosTrader] #487916
11/13/23 12:15
11/13/23 12:15
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
Use -u string instead so that you can manually set values inside the script. Happy parsing!

Edit: Also, -i number if you're only using numbers, so no parsing needed.

Last edited by AndrewAMD; 11/13/23 12:21.
Re: Training with command line parameters [Re: ChaosTrader] #487938
11/26/23 08:42
11/26/23 08:42
Joined: Sep 2017
Posts: 82
T
TipmyPip Offline
Junior Member
TipmyPip  Offline
Junior Member
T

Joined: Sep 2017
Posts: 82
The issue you're encountering, where the Command[0] parameter seems to be set to 0 instead of the passed value when training a script, might be related to the way command-line parameters are handled in Zorro, especially in different modes (like training versus running).

In Zorro, command-line parameters are accessible through the Command array in the script. However, there are some nuances to be aware of:

Initialization Timing: The command-line parameters are usually parsed and initialized before the run function is executed. However, if you're observing that the parameters are not correctly initialized during training, it could be a timing or initialization issue specific to the training mode.

Correct Parameter Index: Ensure that you're using the correct index for accessing the command-line parameters. Command[0] is the first command-line parameter, Command[1] is the second, and so on.

Parameter Parsing: Check if the command-line parameter is correctly parsed and converted to the desired data type. For instance, if you're passing a date like 20230930, you might need to convert it from a string to an integer or a specific date format that Zorro understands.

Batch File Syntax: Ensure the batch file is correctly formatted and passing the parameters as intended. The command should look something like this:

Code
Zorro.exe -run MyScript -i 20230930


Zorro Version: You mentioned using Zorro version 2.56 with an S License. It's worth checking the release notes or updates for your version to see if there are any known bugs or changes regarding command-line parameter handling.

Debugging: Use print statements to debug the script. Print out the value of Command[0] at different points in your script to check when it gets initialized and what value it holds.

Alternative Approach: As a workaround, you could try using a different method to pass the end date. For example, you could read the end date from a file at the start of your script if the direct command-line approach continues to pose issues.


ZorroTraderGPT - https://bit.ly/3Gbsm4S

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