Topic: Balance Line Stability - Development

Hello Traders,

Happy new astronomical year! Yaaahooo!!
Have great luck, love, fun and profit for the whole year.

I have a small present for you today - Balance line stability metric in EA Studio.

It is a round number between 0 and 100. The greater the Balance line stability, the better.

Stability equal to 100 means that the balance is a straight line (possible only if there are 0 or 1 trades smile )

Anyway, every value above 90 is good.

Some examples here.

https://image-holder.forexsb.com/store/balance-line-stability-98.png

https://image-holder.forexsb.com/store/balance-line-stability-94.png

https://image-holder.forexsb.com/store/balance-line-stability-75.png

The Balance line stability is shown at the Report -> Backtest Output table.

It is also available as a sorting method in the Collection sorting and also as an Acceptance Criteria.

https://image-holder.forexsb.com/store/collection-balance-line-stability-sorting-thumb.png

Please reload EA Studio to have the new option.

Trade Safe!

2 (edited by ViniQ 2018-12-22 19:08:56)

Re: Balance Line Stability - Development

Using Balance Line Stability as filter will help a lot, the generator to filter a very stable and "perfect" equity curve,
thank's again for listening ours suggestions.

Re: Balance Line Stability - Development

Yes, really great present, thanks Popov.

Re: Balance Line Stability - Development

Thanks Mr Popov :-)
How is it calculated..?

Re: Balance Line Stability - Development

EA Studio calculates the Balance Line Stability in three steps.

1. It calculates a virtual straight line between the initial and the final balance. It represents the "ideal" stability.
2. It finds the correlation between the Balance curve and the virtual line. It is a number between 0 and 1, where 1 means a perfect overlap.
3. It scales the "representative" part of the correlation in order to make it easier for the human understanding. The scaling formula is:

   stability = 3 * (100 * correlation - 66.66)

After that the value is rounded and limited from 0 to 100 (for any case and for preventing questions smile )

Hope it helps!

6 (edited by Popov 2018-12-26 12:16:37)

Re: Balance Line Stability - Development

Wow!
That was a quick answer :-D
Have a great christmas holiday and a happy new year!

/tim

Re: Balance Line Stability - Development

Hi Popov,

do you have a plan to add "Balance Line Stability" to the optimizer?

Best regards.

Re: Balance Line Stability - Development

do you have a plan to add "Balance Line Stability" to the optimizer?

A great idea! I'll add to my ToDo.

Re: Balance Line Stability - Development

Yay!

Thanks Popov!

Re: Balance Line Stability - Development

Thanks for adding this Popov, great to finally have it in EA Studio :-) Merry X-mas!

Re: Balance Line Stability - Development

Hi Popov,

I just did a few tests with the new metric, and somehow it seems it is too "rounded" or limited (gives to similar values for strategies that have clearly have a pretty different equity curve). Look at the 3 equity lines in these 3 screenshots. For all of them, EA Studio gives a stability value of 99, but the equity curves are pretty different actually as you can see, they can´t all be 99 as 2 of them are clearly far away from a straight line. I´ve added the ideal straight line in RED to make it more clear what I mean. For the first strategy, I completely agree that it almost is a straight line, so the "99" EA Studio shows make sense. However, both other strategies are FAR away from following the straight red line, yet EA Studio also shows them as having "99", which doesn´t make much sense. I´ve re-created all 3 strategies in SQ 3 and SQX and looked at the stability values I am getting there. Strategy 1, of course, has a 0.98 for "Stability", but the other 2 strategies are in the 0.8 area only there, and that is correct, because, as we can see, they do not follow a straight line at all like strategy #1 does.

Can you please turn off the "rounding" (or whatever it is that causes this) or adjust the formula so that strategies like in screenshot 2 and 3 won´t get "99" as well but are in the ~80 area? The metric doesn´t have much use if all 3 strategies get a "99" like if all 3 of them would follow a straight equity line, which clearly is not the case for strategy #2 and #3. Thanks so much :-)

https://i.imgur.com/XGvcc9J.jpg

https://i.imgur.com/fEZmjcw.jpg

https://i.imgur.com/4w04lgG.jpg

Re: Balance Line Stability - Development

There also seems to be a bug with the Balance line stability calculation in the OOS monitor. Have a look at the 2 attached screenshots. First I look at the OOS Monitor (09/09/2015 - now) and Balance line stability shows "47". Then I am using the exact same data-range (09/09/2015 - now) for a normal backtest without OOS, with the exact same strategy and out of sudden, the Balance line stability becomes "77" ;-)

https://i.imgur.com/Qx7eo09.jpg

https://i.imgur.com/pizgqwc.jpg

Re: Balance Line Stability - Development

Yes, I also noticed that problem and already uploaded a solution.

It calculates the stability from the first deal to the last deal. The formula ignores the flat periods before the first deal and after the last deal.

Please recalculate your collections.

14 (edited by GD 2018-12-28 10:27:08)

Re: Balance Line Stability - Development

oh.

Thnaks Popov.

Re: Balance Line Stability - Development

Popov wrote:

Yes, I also noticed that problem and already uploaded a solution.

It calculates the stability from the first deal to the last deal. The formula ignores the flat periods before the first deal and after the last deal.

Please recalculate your collections.

Great, thanks, but which problem you mean? My first post or my second post with the OOS?

Re: Balance Line Stability - Development

Both issues were coming from wrong counting of the control points. Now this is fixed and the formula must work better. Of course, there is a room for improvement.

Re: Balance Line Stability - Development

Great, I will test this, thank you very much :-)

Re: Balance Line Stability - Development

The "OOS" <-> "same data range in a normal backtest" is fixed, great! But I still think the formula has an issue somewhere. Look at this one, for example, it´s all correct that this has a "99.80", as it equals almost a straight line:

https://i.imgur.com/rK1pxt6.jpg

But how can this one have a "98.39", given that it is FAR away from a straight line? If re-creating this strategy in SQX, I get a ~85 value, which seems more logically, as "98.39" would mean it is ALMOST an ideal straight line, but as we can see, it is nowhere following a straight line, so that "98.39" is clearly not right:

https://i.imgur.com/JVSh2lT.jpg

One idea why this might happen: could it be that your formula is putting more weight on the first part of the backtest? Because there the line was almost straight, but then it had a long flat-period, and it seems like your formula is not equally weighting this for the calculation. It´s like if it puts more emphasis on the first half of the trades and if that line has been straight, a later flat period does not influence the value much anymore. It seems to me that if the heavy deviation / flat period is earlier in the backtest, the score gets a lot lower, just like it is not weighing all trades equally. Just a thought...

Thank you.

19 (edited by geektrader 2018-12-29 08:41:50)

Re: Balance Line Stability - Development

P.S.: Here is an even more drastic example that something is wrong in the calculation (or the calculation is right, but the way it´s implemented is flawed). How can this strategy have an stability of 96.47? 96.47 should mean that we have an almost perfect straight line, but this equity line is far from following the straight red line:

https://i.imgur.com/EEBbA0w.jpg

And this equity curve is even worse, yet has an even higher stability value:

https://i.imgur.com/hIQIm77.jpg

Something must be clearly wrong with the calculation.


P.S.2: On a side note: could you possibly add the "Balance Line Stability" (once it works correctly) as an Optimization target? That would be great. Thanks :-)

Re: Balance Line Stability - Development

Im with Geek trader I too have noticed the issue with the line stability, as well as think it would be a great optimisation tool.

Re: Balance Line Stability - Development

Hello guys,

Thank you for the reports!

I'm aware of these problems and think for a solution. It looks like that the current formula is too sensitive to the number of bars and to the initial account amount. I have to adjust it to compensate these factors.

Have great holidays!!

Re: Balance Line Stability - Development

Hi Popov,

yea, it shouldn´t be sensitive to the starting balance, the starting balance shouldn´t be included in the calculation at all, as it has nothing to do with the stability at all. I´ve sent you a PM about the formula you can possible use, please have a look.

Thank you and happy holidays to you too :-)

Re: Balance Line Stability - Development

Popov,

what about using R-squared and Slope the same way as in MT4Tracker..?

24 (edited by geektrader 2018-12-31 17:58:54)

Re: Balance Line Stability - Development

Yea, R-squared would be the solution, I´ve sent him a formula already that uses that.

Re: Balance Line Stability - Development

Hi Popov,

on a side-note: since you´ve added the balance line stability, old setting files add wrong acceptance criteria, because the order of the acceptance criteria has changed with the adding of the balance line stability. That´s something that other users might not notice and might wonder why their acceptance criteria settings are not "working" anymore.

For example: if I load one of my old settings files, it replaced "Max Stagnation %" with "Minimum average HPR %" in the acceptance criteria, because you´ve changed the list/order of the list. For me, it´s no problem to correct this, but not all users might notice that and you might want to add something so that even old settings files will load the correct previously used acceptance criteria.