History & HistoryFolder

Posted By: DdlV

History & HistoryFolder - 11/06/21 22:57

Hi @jcl,

If the History variable is not set, the manual says it defaults to the History subfolder.

This appears to be incorrect if HistoryFolder is set in Zorro[Fix].ini. In that case, History defaults to that HistoryFolder, as expected.

This appears to be the only case that HistoryFolder affects History. If the History variable is set, HistoryFolder appears to be ignored.

If History includes a relative path, it is relative to the Zorro folder. This allows specifying a subfolder of History via, f.i., "History\\subfolder\\*.t6".

I would like to be able to use History to specify subfolders of HistoryFolder, in this same way. Is there a way to do that?

If not, can History be enhanced to default to HistoryFolder if specified, so that one could then do, f.i., "subfolder\\*.t6" to point History to HistoryFolder\subfolder\*.t6?

Thanks.
Posted By: DdlV

Re: History & HistoryFolder - 06/23/22 23:23

Hi @jcl,

I think in any case History should be initialized to the value of HistoryFolder.

In addition, can History's value be included in the Performance Report as a record of what History was used?

Thanks.
Posted By: jcl

Re: History & HistoryFolder - 06/24/22 10:00

That makes sense. I've put it on the todo list and we'll implement it in a future version.

Update: I have been informed that it is already so. History uses the HistoryFolder unless you enter some other folder. For a subfolder of a different history folder, you must enter the full path.
Posted By: DdlV

Re: History & HistoryFolder - 06/24/22 23:42

Hi @jcl,

I just ran a few tests on 2.48:

- Fresh install. Select New Script. At the end of the template that comes up, add "printf("\nHistory=%s", History);". Save. Click Test. Zorro crashes (window just disappears). Log file is 0 bytes.

- Restart Zorro. Add "History="whatever";" before the printf. Save. Click Test. "History=whatever" prints.

- Copy Zorro.ini to ZorroFix.ini. In ZorroFix.ini change HistoryFolder to "somewhere". Restart Zorro. Click Test. Zorro complains there's no history for EUR/USD in somewhere, then prints "History=somewhere".

- Comment out the "History="whatever":" statement. Save. Click Test. Zorro complains there's no history for EUR/USD in somewhere, then prints "History=".

Seems not quite right...

Thanks.
Posted By: Petra

Re: History & HistoryFolder - 06/25/22 18:53

What seems not quite right? The crash?

When you print something without setting it before, it is an empty pointer. It will of course crash.
Posted By: DdlV

Re: History & HistoryFolder - 06/27/22 05:48

Thanks @Petra. Based on @jcl's comment above, History should be initialized to HistoryFolder's value, therefore should not be an empty pointer, therefore should not crash! It appears that History is in fact not being initialized...
Posted By: Petra

Re: History & HistoryFolder - 06/27/22 08:05

History is a string to be set by the user. It has no content when you dont set it. And when you set it it defaults to the historyfolder unless you explicitly set a different folder.

https://zorro-project.com/manual/en/script.htm
Posted By: DdlV

Re: History & HistoryFolder - 06/27/22 15:07

Thanks @Petra. Actually, the linked page is labelled "Predefined Strings" and says History has a default value when not set by the user. This simply appears not to be the case. At least not completely. It appears to take a non-default HistoryFolder value, but appears to be uninitialized when HistoryFolder is its default "History". I believe it should be initialized in all cases, no?
Posted By: DdlV

Re: History & HistoryFolder - 06/30/22 01:32

Hi @jcl. Not sure if you continued following this thread. Thanks for @Petra's help! But it still appears there's a problem/bug in the initialization of History.
Posted By: jcl

Re: History & HistoryFolder - 06/30/22 07:18

What problem do you have still?
Posted By: DdlV

Re: History & HistoryFolder - 06/30/22 21:37

1) If HistoryFolder is the default value of "History", the History variable is not initialized. History should be initialized in all cases.

2) The manual is incorrect - if HistoryFolder is set, the History variable is initialized to that value.

3) The value of the History variable should be added to the Performance Report.

Thanks.
Posted By: jcl

Re: History & HistoryFolder - 07/01/22 07:29

History is a user supplied string. That means you create it. You can initialize it to anything you want, and add it to the performance report with the print function. We'll improve the description in the manual.
Posted By: DdlV

Re: History & HistoryFolder - 07/01/22 14:57

Thanks @jcl. Addressing your comments using the labels above:

1) Not exactly so. As noted earlier in the thread, History is initialized by Zorro under certain conditions. The request is that History _always_ be initialized to the value of HistoryFolder.

2) Thanks!

3) True. Except for the Z Systems. They respect HistoryFolder, which is great! Please don't change that. But if I want to Test, say, Z1 using different Broker datasets referenced via HistoryFolder, the Performance Report should say which HistoryFolder was used - rather a critical piece of information...

Thanks.
© 2024 lite-C Forums