Upgrading - Testing for Margin setting?

Posted By: DdlV

Upgrading - Testing for Margin setting? - 06/21/15 16:55

Hi jcl. On the Trading page under Switching Strategies, the 2nd bullet says:

Code:
If the new strategy has a different Required Capital than the old one - this is often the case for the Z systems - run a test with the old one at the current Margin setting, note the capital, then install the new one with Margin adjusted so that the same capital is required.



Is this correct? In prior threads the upgraded system/strategy was to be Tested to the Required Capital that was originally started with.

For example, say a strategy was started with a Margin setting of 50 reflecting an initial Required Capital invested of $1,000. The strategy has done well, and profits have been reinvested per the square root rule such that Margin is now at 75. If one is now going to upgrade and Tests per the above with Margin 75, won't the resulting Required Capital be too large, essentially ignoring the trading time that has passed, violating the square root rule, and leading to greater risk of margin call?

If on the other hand the above method is OK (possibly equivalent to the other method?), how does one apply the square root rule going forward? Initial capital is used in the formula - in the example above is that the original $1,000 or the newly-calculated Required Capital?

Thanks.
Posted By: jcl

Re: Upgrading - Testing for Margin setting? - 06/22/15 10:46

The method is ok. You have already observed the square root rule by increasing the margin to only 75. The capital on your account must therefore be higher than the required capital for Margin 75. So you can continue with the new system and identical capital setting.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/22/15 14:20

OK. But what about the application of the square root rule going forward?

The old system Tests to CR of $1k for Margin 50. It will Test to a higher CR for Margin 75 - say $3k to make the numbers simple. Using the $3k from this last old system Test and Testing on the new version gives Margin of, say, 42. I trade the new system at Margin 42 for a while longer, and make even more $$$ (of course! laugh ).

Now, when using the square root rule formulas, what do I use for C=Capital? The original $1k? Or the new $3k? I need to stick with the $1k, correct?

Thanks.
Posted By: jcl

Re: Upgrading - Testing for Margin setting? - 06/22/15 14:36

Yes. The C in the formula is your initial capital regardless of how many Zorro versions you have installed inbetween.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/22/15 14:37

Thanks.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/22/15 15:06

Hi jcl. Please bear with one more follow-on question: What about adjusting Margin for reinvesting profits?

The formula was ReinvestedProfitsMargin=(CurrentCapital/OriginalCapital)*OriginalMargin. CurrentCapital is calculated from Profit, Withdrawals, and OriginalCapital, so no problem. But what about OriginalMargin? That can't be the original Margin from who knows how many versions ago that Tests differently than the new version, can it? Doesn't it need to be the Margin that Tests on the new version to CR~=OriginalCapital?

Thanks.
Posted By: jcl

Re: Upgrading - Testing for Margin setting? - 06/23/15 11:41

That formula is only valid when the relation of Margin and Capital is approximately linear.

When changing versions, better don't use that formula but determine Margin as described above.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/23/15 13:27

Thanks jcl. But I don't think we're on the same page. I understand between versions there are potential discontinuities and the formula can't be directly applied. However...

Q1: While running a given version and not upgrading to a different version, I wish to reinvest profits. Since I'm still in "linear land" since I haven't changed versions, the formula applies, correct?

Q2: If the above is correct and the formula applies during the time period of running a given version, what do I use for OriginalMargin after an upgrade(s) has occurred?

Going back to the example numbers and expanding the example:

I start Zx 1.17 with $1k because it Tests to CR of $1k for Margin 50. Zx of course laugh does a wonderful job and balance rises to $3k. Since I'm still on 1.17 I apply the linear formula and get a new Margin of (say) 75.

Now 1.32 comes out. Following your prescription above, I Test 1.17 at Margin 75 and come up with CR of (say) $2k. I run a bunch of Tests on 1.32 and find that Margin 103 gives CR ~= $2k. So I upgrade to 1.32 and set Margin to 103.

1.32 does even better than 1.17 (of course laugh ) and after a bit my balance is $10k. I want to reinvest profits. Since I'm still running 1.32 and in its "linear land", the formula above applies - except: What number do I use for OriginalMargin?

Q3: Or, if the "linear land" formula becomes completely invalid after any upgrade, what formula do I then use to compute new Margin for reinvesting?

Thanks.
Posted By: jcl

Re: Upgrading - Testing for Margin setting? - 06/23/15 14:32

Q1 - Yes. Q2 and Q3 - No, for the Margin setting use the method from the manual, with the backtest.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/23/15 15:36

Thanks jcl. But that's a bit too cryptic for my level of understanding currently. frown

By "the manual", do you mean the Money Management page? The only thing it says about updating Margin is NewMargin=sqrt(CurrentBalance/OriginalCapital)*OriginalMargin.

Let's be concrete again, starting with that page's example. I start Zorro and strategy Zn version <original> with $1k, Margin 50. The account doubles and to reinvest per the formula I now set NewMargin=sqrt(2000/1000)*50~=70.

Now I upgrade Zorro and Zn to version <new>. I Test version <original> with Margin 70 and get (say) CR=$1.5k. I Test many different Margin values on version <new> and find that Margin=103 gives CR~=$1.5k. So I start Trading version <new> with Margin=103.

The account doubles again, and I want to reinvest using the formula from the manual. Which of these is correct?

a) NewMargin=sqrt(4000/1000)*50
b) NewMargin=sqrt(4000/1000)*103
c) other

Thanks.
Posted By: jcl

Re: Upgrading - Testing for Margin setting? - 06/23/15 17:14

I think c) wink. Just calculate your capital with the square root rule from the manual, then use the backtest for setting the Margin slider so that it matches the capital. From your posts I see that you have understood how to do this. The other formula was just the rule of three for quickly adjusting the Margin slider to a new investment. It was not for updating to a new version. If it causes trouble and confusion then just forget it and set Margin by backtest.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/23/15 17:46

Thanks jcl. We're finally in agreement on a lot of things!!! laugh

I thought the correct answer was c) too.

I agree with not using a formula(s) one doesn't understand - that's why I keep asking... laugh

I also agree with saving backtests - especially now that they take so long, esp. for Z12. frown

While I understand the method above, it's even more so too cumbersome now given the latest Z12's Test times. Can't the rule of 3 save us?! laugh We don't all have unlimited budgets to run on Tianhe-2, aka Milky Way 2... laugh

So, my (perhaps final laugh ) question is: Can the rule of 3 be applied as follows: Run backtests only once for the new version to find the Margin setting that gives the original, starting CR. Then apply the rule of 3 using that NewVersionOriginalMargin?

In the example above, run backtests to find NewVersionOriginalMargin = Margin on <new> version that gives CR=$1k.

Then, whenever one wants to reinvest (while still on that same version) no backtests needed! Simply rule of 3 calculate NewMargin=(CurrentCapitalPerSquareRootRule/OriginalCapital)*NewVersionOriginalMargin.

This seems to me to apply the rule of 3 as if no earlier versions existed and only the new version had been run since starting. Is there some reason this doesn't work?

Thanks.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 06/30/15 02:32

Hi jcl. Wondering if you've had time to review the above and if this alternate method works?

Thanks.
Posted By: jcl

Re: Upgrading - Testing for Margin setting? - 07/01/15 09:16

This should work. The rule of 3 is valid as long as the linear relationship between the parameters does not change.
Posted By: DdlV

Re: Upgrading - Testing for Margin setting? - 07/01/15 12:44

Thanks for the confirmation! This is certainly _much_ faster than running Tests every time!

Thanks.
© 2024 lite-C Forums