1 (edited by slowkey 2013-05-27 22:19:15)

Topic: "Generate higher profit than the initial strategy"

Posting this here since it will be in the final 3.0.

"Generate higher profit than the initial strategy"

Will this check box be over ridden by the custom sorting if it is used or will it still have some role to play even if custom sorting is chosen.

What got me thinking about this was the following comment. The part where the double slashes are observed below. What relationship if any does this previous use of this choice have with the custom sorting.

- The text "Generate a new strategy at every start" in Generator is not with a correct meaning. A user can think that if he switch off this option, the Generator will somehow improve his strategy. The true is that this option means that:

// when it's off: Generator will start accepting every strategy that has profit  > 0;
// when it's on: Generator will search a strategy that has greater profit than the current one.

It would seem to be overriding the box but just wanted to be clear in my thinking.

I want to thank Adam for this terrific custom sorting contribution and Popov and him for implementing it into version 3.0 ...

Re: "Generate higher profit than the initial strategy"

First, I just now found that this check boxes has a BUG. It works in the opposite way I wanted sad .
The old text of the check box was "Generate a new strategy at every start" and the new text is "Generate higher profit than the starting". The new text has an opposite meaning according to the older but I haven't mirrored the logic. I'll correct the text or the logic as soon as we establish the desired behavior. The check box code name is chbGenerateNewStrategy.

When user press "Generate" button, Generator sets a variable bestValue.

            if (chbGenerateNewStrategy.Checked)
                bestValue = 0;
            else if (rbnCustomSortingNone.Checked) // No custom sorting
                bestValue = Backtester.NetBalance;
            else
                bestValue = float.MinValue;

Is the code clear?

If chbGenerateNewStrategy is checked on, bestValue is set to zero.
If chbGenerateNewStrategy is checked of and:
     - do not use custom sorting: bestValue is set to current NetBalance.
     - with custom sorting: bestValue is the lowest possible negative number.

Generator starts:

Generator selects a random count of indicators and random indicator parameters at every calculation cycle. The strategy shape must correspond to the settings of max opening and max closing logic slots and also it takes into account the locked and linked slots.

After that Generator performs backtest calculations.

Simplified code:

Backtester.Calculate();
Backtester.CalculateAccountStats();

float value = 0;
if (IsCriteriaFulfilled())
{
    if (rbnCustomSortingNone.Checked) // No custom sorting
        value = Backtester.NetBalance;
    else
        value = CustomSortingResult()

    if (bestValue < value)
    {
        bestValue = value;
        AddStrategyToGeneratorHistory(description);
        RefreshSmallBalanceChart();
        RefreshAccountStatistics();
        RebuildStrategyLayout(strategyBest);
        Top10AddStrategy();
    }
}

First Generator checks if all criteria from "Criteria" tab are fulfilled.
If not, Generator starts new generation.

After that Generator sets the calculated  result in a variable value.
   If we do not use custom sorting, value = Backtester.NetBalance
   If we use Custom Sorting, value =  CustomSortingResult()

Later, Generator compares value and bestValue.
  If we have greater value (it means greater profit or greater Custom Sorting result), Generator updates all charts and stats and pushes the strategy at the top of Top10.

...

An example with no custom sorting and chbGenerateNewStrategy is checked:
If we have a strategy with NetBalance = 7000.

We press Generate button Generator sets bestValue = 0;

Generator generates and calculates a strategy.
It checks if all criteria are fulfilled.
- if not, it starts new calculation

Lets say that the new strategy has NetBalance = 5500

Generator compares the new NetBalance with bestValue.

And since bestValue = 0, Generator accepts the new strategy.
Generator sets bestValue = 5500.


....

An example with no custom sorting and chbGenerateNewStrategy is NOT checked:
If we have a strategy with NetBalance = 7000.

We press Generate button Generator sets bestValue = 7000;

Generator generates and calculates a strategy.
It checks if all criteria are fulfilled.
- if not, it starts new calculation

Lets say that the new strategy has NetBalance = 5500

Generator compares the new NetBalance with bestValue.

And since bestValue = 7000, Generator does not accepts the new strategy.

It generates new strategy. Lets say it has NetBalance = 7500.
This time Generator will accept the strategy and will set bestValue = 7500.

..........

So when chbGenerateNewStrategy is checked, Generator accepts the first generated strategy that satisfies all criteria.

When chbGenerateNewStrategy is NOT checked, Generator accepts the generated strategy that satisfies all criteria AND has greater profit than the initial strategy.

...

The question is now with what text to display chbGenerateNewStrategy check box!

Re: "Generate higher profit than the initial strategy"

Popov wrote:

The question is now with what text to display chbGenerateNewStrategy check box!

I read through the code and logic and understand how this works now in detail. I need to sleep but maybe after that a text statement to display may come to mind.

Thanks Popov for explaining this.

Doug

Re: "Generate higher profit than the initial strategy"

The generator is brainless and random but very powerful. It can not save its state. What is met is criteria we determine ahead of time and if they are met a value is attached to a particular combination of indicators that represent a new strategy. These are than sorted and stacked in the top 10 based on the sorting we have chosen either profit or custom. The new set of values than becomes the starting point for a new cycle in the generator.  The generator continues to cycle through this process stacking new strategies as higher profit or value is achieved until the time runs out or other parameters are met.

If the box is checked any previous value is not saved when the generator is stopped and than restarted. It is given default values all over again. That being either net balance or a minimum value depending on the sort. I suggest something like this.

"Un-check to generate from present calculated value or profit" or "Check to generate a new calculated profit or value on restart"

Others may find a more elegant or simpler way of stating this. I think I have thought this through correctly ... Maybe smile  ... Popov ? smile

This as you say is not a way to improve a strategy by itself.

However a strategy can be locked down at this point and when the generator button is pressed depending on open logic slots only strategies with higher value can be chosen. The user is the determiner of why the strategy is better but you know with this button unchecked the generator will restart at the present value. If you do not lock down the logic it will generate from the present value and profit but the present strategy will be a starting point only and may completely change to unrecognizable.

Re: "Generate higher profit than the initial strategy"

This is going to be hard to define as each user has developed a sequence for testing and developing strategies.....

Attempting precision with this phrase may end up being a problem.

A general description may be more appropriate.

My 'secret' goal is to push EA Studio until I can net 3000 pips per day....

Re: "Generate higher profit than the initial strategy"

[v] Generate from zero profit at every start.

Re: "Generate higher profit than the initial strategy"

Popov wrote:

[v] Generate from zero profit at every start.

Like smile

No mater how you sort it conveys the idea behind what is happening.

Re: "Generate higher profit than the initial strategy"

[v] Generate from zero profit at every start.
It's good because keeps the same direction as the old
[v] Generate a new strategy at every start.

I'll not have to change the present logic smile