Zorro chrashes with no error code

Posted By: Puezzin

Zorro chrashes with no error code - 01/26/23 14:54

Hi,
newbie here, I started to use Zorro a couple weeks ago.

I am trying to work my way through a few examples of codes/strategies from the robotwealth's blog to familiarize with the coding language and Zorro.
It was all working well until I came around to the example in this blog post: https://robotwealth.com/shannon-entropy/

I am trying to run the second code of the post, which I have saved as a strategy under the name: "ShannonEntropyStrategy" (attached).
If I test the strategy and stop it before Zorro has worked through the whole time series, I get the graph in the screenshot attached; otherwise, Zorro crashes before completing the calculation, without throwing any error.

I do have an API key for the Alpha Vantage API (as required in the blog post) which I have saved in my ZorroFix.ini file.

I thought I had messed up something (as I did not make any changes in the script, apart from changing the starting date), so I tried unistalling and re-installing Zorro, but the problem persists.

I am running Zorro 2.53 on a W10 laptop with AMD Ryzen 7 4000 series with 64GB RAM.

Would be grateful for any help.

Attached picture Screenshot 1.png
Attached File
ShannonEntropyStrategy.c  (32 downloads)
Attached picture Screenshot2.png
Posted By: AndrewAMD

Re: Zorro chrashes with no error code - 01/26/23 15:03

That's a third-party script. Time to debug it!

https://zorro-project.com/manual/en/trouble.htm
Posted By: vinitrinh

Re: Zorro chrashes with no error code - 02/15/23 14:40

I don't see anything wrong with the script.

@Puezzin, did you manage to find out what is wrong?
Posted By: nsg

Re: Zorro chrashes with no error code - 02/26/23 09:17

If anyone's still interested, there's an extra % in the beginning of printf statement:

Code
    if(is(EXITRUN))
        printf("\n\n%W: %.2f%%\nWins: %d Losses: %d\nWinTot: %.0f LossTot: %.2f\nPips/Trade: %.1f", 
        100.*win/(win + loss), win, loss, winTot/PIP, lossTot/PIP, (winTot-lossTot)/PIP/(win+loss));


Should be:
Code
    if(is(EXITRUN))
        printf("\n\n W: %.2f%%\nWins: %d Losses: %d\nWinTot: %.0f LossTot: %.2f\nPips/Trade: %.1f", 
        100.*win/(win + loss), win, loss, winTot/PIP, lossTot/PIP, (winTot-lossTot)/PIP/(win+loss));


BTW, misspelled printf statements is one of the most frequent reasons of crashing with no error code. Cool piece of code though.
© 2024 lite-C Forums