Gamestudio Links
Zorro Links
Newest Posts
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
Release 2.68 replacement of the .par format
by Martin_HH. 09/23/25 20:48
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 16,415 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Wrong AGR caculation on BuyHold.c #488832
07/29/25 17:41
07/29/25 17:41
Joined: Jul 2025
Posts: 6
E
Estotrader Offline OP
Newbie
Estotrader  Offline OP
Newbie
E

Joined: Jul 2025
Posts: 6
Hello! I am impressed with the zorro software, i discovered it 2 weeks ago, and i am trying to get used to it, and test before buying, but today i am very disapointed.

I open the inbluid BuyHold.c strategy, test, and get results, but Annual growth rate is wrong, it tells 26.76%, but it is not, it is more like 15% CAGR (from 117 to 637 in 12 years)

Test period 2013-01-03..2025-07-28 (3159 bars)

I download the data from mi IB account (SPY.t6), and seem fine, in the chart i can see prices are rigth, first price 117, last price 637

I attatch some secreens, but you can try by yourself.....

What i'am doing wrong??
Thanks in advance

Ernesto, "Estotrader"


Edit: I add the files Buyhold.c and Spy.t6 just in case here https://drive.google.com/drive/folders/1yfn-09VhaRwxIvs8MOmpCImuC7qdHDeB?usp=drive_link

Attached Files buyholdtxt.jpgbuyholdreturns.jpgbuyholdrscrpipt.jpg
Last edited by Estotrader; 07/30/25 08:31.

Ernesto "Estorader"
Options Trader
Re: Wrong AGR caculation on BuyHold.c [Re: Estotrader] #488833
07/30/25 03:33
07/30/25 03:33
Joined: Feb 2017
Posts: 1,806
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,806
Chicago
You miscalculated CAGR. I approximated values based on the blue chart, and assuming a starting value of $10k, an ending value of $195k, and a number of periods = 13 years, that gives you a CAGR of about 26%.

Try it:
https://cagrcalculator.net/

Re: Wrong AGR caculation on BuyHold.c [Re: AndrewAMD] #488834
07/30/25 08:48
07/30/25 08:48
Joined: Jul 2025
Posts: 6
E
Estotrader Offline OP
Newbie
Estotrader  Offline OP
Newbie
E

Joined: Jul 2025
Posts: 6
Thanks AndrewAMD.

But i can not understand how if SPY went from 117 to 637 , and how just Buy and hold can lead you from 10k to 195k, because in the BuyHold.c i cant see leverage.

The strategy must buy $10k SPY at 117 (10k/117=85shares), and at the end we must have 85*637=$54145, that is 15%

I think i still thinking or doing somethink wrong in my maths, or something else that i cant see..... but i do not know what it is,

For example the strategy won 119% in 2013 but SPY just won 32%, seem a 3.7 leverage but it is not in de code

Last edited by Estotrader; 07/30/25 08:55. Reason: bad orthographic

Ernesto "Estorader"
Options Trader
Re: Wrong AGR caculation on BuyHold.c [Re: Estotrader] #488835
07/30/25 12:05
07/30/25 12:05
Joined: Feb 2017
Posts: 1,806
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,806
Chicago
You’re using the CFD-based parameters. Comment out the USE_CFD define macro.

Re: Wrong AGR caculation on BuyHold.c [Re: AndrewAMD] #488836
07/30/25 14:28
07/30/25 14:28
Joined: Jul 2025
Posts: 6
E
Estotrader Offline OP
Newbie
Estotrader  Offline OP
Newbie
E

Joined: Jul 2025
Posts: 6
Thanks AndrewAMD for early answer.

Seem things are more clear to me, after uncommented USE_CDF, thanks


Abusing your kindness, now, new questions surges to me
.
1-No matter Capital=Number is, strategy go long 128*SPY, of course i can write enterlong(desired_amount), but enterlong() invoque 128*SPY, i am confused why 128, but i can solve entering desired amount in enterlong()

2-MaxDardown row in BuyHold.txt are forever= XXXX 0.0% (YYYY MAE 22.9%). I mean, Capital (the variable) can be 10k or 1000k but Maxdrawdown holds in 0.0% (MAE 22.9%), MAE have no sense for me, i understand if SPY had a -33% in 2020, MAE at least should have -33%, guessing MAE is just for the capital invested in SPY. For me the desirable MAE or MaxDarwdowm calculation would be from all equities+cash Top to all equities+cash bottom, i mean the usual MaxDrawdown of te whole thing.

At least Capital (the variable) is taken to calculate the CAGR as desirable, and also CAGR calculaltion is rigth, as it takes the Capital in cash left + the capital invested in SPY.
Thanks in advance


Ernesto "Estorader"
Options Trader
Re: Wrong AGR caculation on BuyHold.c [Re: Estotrader] #488837
07/30/25 16:38
07/30/25 16:38
Joined: Feb 2017
Posts: 1,806
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,806
Chicago
1 - In your code, lot size is set by Margin. Details about different ways to size lots are in the manual.
2 - "Drawdown" observes changes in balance, whereas MAE observes changes in equity. This is a buy and hold operation, so balance is static until the trades close. Meanwhile, equity is variable.

Re: Wrong AGR caculation on BuyHold.c [Re: Estotrader] #488840
08/05/25 10:07
08/05/25 10:07
Joined: Jul 2025
Posts: 6
E
Estotrader Offline OP
Newbie
Estotrader  Offline OP
Newbie
E

Joined: Jul 2025
Posts: 6
Tanks AndrewAMD

1-Perfect, i have to study that part, but have sense

2-I understand now Drawdown = just balance, but the MAE percentage is calculated in total shares bougth, so if you chage cuantity in the enterlong(); at the file 50 of the BuyHold.c script you get this:

enterLong(50); // Outcomes in BuyHold.txt--> Max drawdown -10.72$ 0.0% (MAE -5739$ 23.1%)
enterLong(150);// Outcomes in BuyHold.txt--> Max drawdown -32.17$ 0.0% (MAE -17217$ 23.1%)

So really MaxDrawdown and MAE is changing in amount but not in percentage.
I understand Zorro is thougth like that, but as i need to take care of maxdrawdwon in real time in my code, i will need to code some "real whole drawdown entire profolio+assets+cash at this moment not waiting trades are closed" in order to check the "real" drawdown of the thing.

function RealDrawdownNow_in_percentage() // I must code this

Many thanks, still fighting with zorro dayly , i gues i will get it with time, Zorro is impresive but for a newbie like me, something are still dificault to understand


Ernesto "Estorader"
Options Trader

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1