Money Management with ProfitClosed when restarting a strategy

Posted By: trenki2

Money Management with ProfitClosed when restarting a strategy - 09/07/16 07:00

The workshop about money management talks about the square root rule and proposes the following formula for money management:

Code:
Margin = 0.5 OptimalF * Capital * sqrt(1 + ProfitClosed/Capital);



Now the trade statistics page says "Trade statistics are updated on every bar. They are reset when the strategy is restarted. For preventing this, they could be copied into global variables or saved in a file that is loaded at start of the strategy."

So this means, the money management with the above formula only works when I never restart the strategy as when I do ProfitClosed will be reset to 0 right?

How can I make it work the right way, even when restarting the strategy? Save ProfitClosed on every bar in a file and restore it in the INITRUN and add that value to the zorro ProfitClosed value?
Or store it in AlgoVars (but there is only a limited amount of them). What about global variables are they somehow stored?
Posted By: jcl

Re: Money Management with ProfitClosed when restarting a strategy - 09/07/16 08:17

Yes, you can store it in an AlgoVar. It is then loaded at restart.
Posted By: chsmac85

Re: Money Management with ProfitClosed when restarting a strategy - 12/01/18 17:03

I am working through the black book and have arrived at the money managemetn section

This is an old topic so maybe it has been addressed. Oanda has been doing system maintenance on their platform and two of the times in the past month I've had to restart the algo in order to re-authenticate zorro with the Oanda server.

Will profit closed reset to zero in z12 system each time I restart?

Since z12 is a compiled file, I can't edit it as above.
Is there a workaround that can help prevent me losing everything due to a margin call!?

I know the simplest solution is to write my own algo so I can customize everything but I haven't coded one that can beat z12 yet laugh
© 2024 lite-C Forums