Starting with Zorro-trader

Posted By: YesNotes

Starting with Zorro-trader - 03/23/23 23:26

Hello, I am totally new to zorro-trader and always have huge problems with my variable declarations,
so I did restart from scratch this most simple test-script to simply show the date and time.

Code
// Declare variables
int year = 2022;
int month = 3;
int day = 23;
int hour = 15;
int minute = 30;
int second = 0;

// Create datetime object
datetime myDateTime = date(year, month, day) + time(hour, minute, second);

// Print datetime object
printf("My date and time: %s", strdate(myDateTime));


Zorro 2.53.9 does throw, however following error:
Error in 'line 11:
syntax error
< datetime myDateTime = date(myYear, myMonth, myDay) + time((int)myHour, (int)myMinute, (int)mySecond); >.

Can anyone tell me what I am doing wrong?
Posted By: alun

Re: Starting with Zorro-trader - 03/24/23 13:25

Hi YesNotes,

Doesn't seem like this code is using any valid Zorro functions for dates:

https://zorro-project.com/manual/en/month.htm

Is it something from C API? maybe you need to add some includes to make this work
Posted By: AndrewAMD

Re: Starting with Zorro-trader - 03/24/23 13:30

First of all, if you haven't already, you should do the Lite-C tutorial from beginning to end. Definitely play around with those sample scripts. It starts here:
https://zorro-project.com/manual/en/tutorial_var.htm

Second, there is no such thing as datetime in Zorro. If you don't understand the MT4 code you received, you won't understand how to implement it in Zorro either.

Read the MQL4 and MQL5 docs for reference purposes:
https://docs.mql4.com/
https://www.mql5.com/en/docs

datetime, defined below, works completely differently than anything in Zorro:
https://docs.mql4.com/basis/types/integer/datetime
https://www.mql5.com/en/docs/basis/types/integer/datetime

Finally, check out this conversion reference if you haven't already:
https://zorro-project.com/manual/en/conversion.htm
Posted By: YesNotes

Re: Starting with Zorro-trader - 03/27/23 11:07

Once more thank you, Alun and Andrew,
(I accidentally deleted this comment, so I repost it)
Since I am totally new and have to learn everything from scratch anyway
I will consider other methods or programming languages for comparing different trading times,
for my research purposes, because trading as of yet is not an issue for me.
© 2024 lite-C Forums