TRAINMODE and history length

Posted By: hatten

TRAINMODE and history length - 01/01/18 15:18

I have to issues that I have been unable to resolve myself:

1. It would be valuable to have access to the length of the history of each asset downloaded. When running assetHistory the number of bars is printed in the zorro panel, but can this value be retrieved or stored for use in the program? If so, how?

2. The Z8/Z9 strategy has a useful function incorporated. When pressing the train button key asset values are printed in the zorro window and a correlation chart is plotted. I would love to use the possibility of triggering such output functions when pressing the train button, but I have been unsuccesful to accomplish this by simply verifying with

if (is(TRAINMODE)) printf("...

or

if (is(TRAINMODE) && is(EXITRUN)) printf("...

So what needs to be done? Do I need to donwload the asset history again and calculate whatever I wish to print?

Thanks for any help.
Posted By: jcl

Re: TRAINMODE and history length - 01/01/18 17:09

I think you get the bars only by opening the .t6 dataset. The idea with the trainmode was correct, only printf does not print in training mode.
Posted By: hatten

Re: TRAINMODE and history length - 01/01/18 20:33

Well, then how do I print something in the zorro window during train mode. The Z8 and Z9 strategies succeed in doing so! Basically my question remains unanswered.
Posted By: Dalla

Re: TRAINMODE and history length - 01/01/18 21:16

The manual mentions +TRAINMODE to print also in train mode.
Rather than printf, you would use print. For example to print to window, log file, and in train mode:

Code:
print(TO_WINDOW+TRAINMODE,"<br>Low volatility - ATR30 = %.3f",ATR(30));



You could also use TO_ANY for short:

Code:
print(TO_ANY,"<br>Low volatility - ATR30 = %.3f",ATR(30));



More details here
http://manual.zorro-trader.com/printf.htm
Posted By: hatten

Re: TRAINMODE and history length - 01/01/18 21:36

Excellent. Thank you.
Posted By: hatten

Re: TRAINMODE and history length - 01/06/18 19:04

Just in case anyone cares. I solved my question on how to retrieve the length of the history of an asset in the following fashion assuming the filename is contained in the string tempname:

string tempname = "History\<asset>.t6";
int HAsset;
HAsset = dataLoad(1,tempname,7);

Really simple, but it takes some reading in the manual to figure it out.
© 2024 lite-C Forums