forex software

Create and Test Forex Strategies

forex software

Skip to forum content

Forex Software

Create and Test Forex Strategies

You are not logged in. Please login or register.


Forex Software → Express Generator → Output of very similar strategies in a row

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 14

1 (edited by geektrader 2022-10-28 00:33:32)

Topic: Output of very similar strategies in a row

Hi Mr. Popov,

since I have set the auto-saving feature to save all "1" strategies (so each JSON file holds a single strategy), I have noticed that Express Generator sometimes outputs files in batches at the very same time with strategies that have just slightly different rules and almost the exact same stats.

https://i.ibb.co/4mSC0Cg/Untitled.png

By the dates/time of the file names, we can see that the strategies have been saved at the same minute, and looking at the content of the JSON files, the logic is almost precisely the same, except for some variation in the exit indicators, but still resulting in nearly the same strategy statistics (return/drawdown, r-squared, etc.).

Is this intended behavior? Is Express Generator quickly trying deviations of the strategy when it found a strategy that passes the acceptance criteria to see if it can "quickly" improve it with some other exit indicators? I am just wondering, because this happens almost all the time that I am getting strategies with almost the same content saved at the same minute, this can´t just be random but most likely is a hidden feature of Express Generator?

Thanks for clarifying and your great work :-)

Re: Output of very similar strategies in a row

Yes, you are right.

The Generator constantly modifies a strategy one step at a time.

It chooses a random modification action of the current strategy:

        const oppIndex: number = Helper.randomInteger(0, 100 - 1)

        if      (oppIndex <   5) operations = ComposerOperations.ChangeStopLoss
        else if (oppIndex <  10) operations = ComposerOperations.ChangeTakeProfit
        else if (oppIndex <  20) operations = ComposerOperations.AddOpenFilter
        else if (oppIndex <  50) operations = ComposerOperations.ChangeOpenFilter
        else if (oppIndex <  60) operations = ComposerOperations.RemoveOpenFilter
        else if (oppIndex <  70) operations = ComposerOperations.AddCloseFilter
        else if (oppIndex <  90) operations = ComposerOperations.ChangeCloseFilter
        else if (oppIndex < 100) operations = ComposerOperations.RemoveCloseFilter

Then there is a complex logic for validation and fixing the chosen action:

        switch (operations) {
...
            case ComposerOperations.RemoveOpenFilter:
                if (numEntryInds === 0)
                    return ComposerOperations.AddOpenFilter
                else if (numEntryInds === 1)
                    return ComposerOperations.ChangeOpenFilter
                break
...

Then there is logic for choosing which indicator to add/modify.

Then each indicator has "own generator" for changing its parameters depending on the position in the strategy.

For example, if the program decides to modify Moving Average indicator and it is "Opening Logic Condition" and:
- it is the first indicator slot - it chooses between "single event signals":
   - Indicator changes its direction upwards
   - Indicator changes its direction downwards
   ...
- if it is second and further. It choses between "continues signals":
  - Indicator rises
  - Indicator falls
  ...

Something like that...

Lets say Express Generator is more clever than EA Studio, which is more clever than FSB Pro.

Re: Output of very similar strategies in a row

Express Generator is the best ... "generator".

However, we decided to add Optimizer/Normalizer and Monte Carlo to it, which was not my initial plans.

Unfortunately, it cannot be done without "breaking" the perfect generator workflow.
Nor, exporting experts can be done.
Nor even printing the indicators logical rules, because there is no such.

In reality Express Generator comprises:
- settings manager
- data-manager - import, Data horizon, OOS, ...
- strategy composer
- 36 generators - one for each indicator
- strategy backtester
- central-application - main-loop, events
- collection-manager - sorting, correlation, import, export, ...
- plumbing to make it suitable for running from the console

Re: Output of very similar strategies in a row

Thank you! Very interesting and complex + smart, I already thought that this is a feature :-) Superb work!

Still, I sometimes get actually completely identical strategies saved in a row. Have a look at this screenshot. One strategy is a little different (normal as you say), but 2 of them are 100% identical strategies.

https://i.ibb.co/Sfqn4mq/Untitled.png

Re: Output of very similar strategies in a row

> One strategy is a little different (normal as you say), but 2 of them are 100% identical strategies.

This is the price of exporting and emptying the collection - there is no equality / correlation analysis.

"but 2 of them are 100% identical strategies." this is only for you. for the Generator the collection is empty and it "collects" the first passed.

6 (edited by geektrader 2022-10-28 04:26:17)

Re: Output of very similar strategies in a row

Yes, all good, the correlation analysis would otherwise filter them if I wouldn't clear the collection after saving, that's clear and is no problem. Just seemed odd that it would calculate/find 2 times the exactly same strategy in a row, with no changes at all. As far as I understood your logic, the second strategy should at least differ a little bit (e.g. with a different exit indicator or slightly different periods) but it should not have 100% the same logic/settings? It would otherwise mean that it wastes one calculation of a backtest for a strategy it already calculated one step ago.

Re: Output of very similar strategies in a row

How does numerical parameter modification (optimization?) come into play?

Popov wrote:

Yes, you are right.

The Generator constantly modifies a strategy one step at a time.

It chooses a random modification action of the current strategy:

        const oppIndex: number = Helper.randomInteger(0, 100 - 1)

        if      (oppIndex <   5) operations = ComposerOperations.ChangeStopLoss
        else if (oppIndex <  10) operations = ComposerOperations.ChangeTakeProfit
        else if (oppIndex <  20) operations = ComposerOperations.AddOpenFilter
        else if (oppIndex <  50) operations = ComposerOperations.ChangeOpenFilter
        else if (oppIndex <  60) operations = ComposerOperations.RemoveOpenFilter
        else if (oppIndex <  70) operations = ComposerOperations.AddCloseFilter
        else if (oppIndex <  90) operations = ComposerOperations.ChangeCloseFilter
        else if (oppIndex < 100) operations = ComposerOperations.RemoveCloseFilter

Then there is a complex logic for validation and fixing the chosen action:

        switch (operations) {
...
            case ComposerOperations.RemoveOpenFilter:
                if (numEntryInds === 0)
                    return ComposerOperations.AddOpenFilter
                else if (numEntryInds === 1)
                    return ComposerOperations.ChangeOpenFilter
                break
...

Then there is logic for choosing which indicator to add/modify.

Then each indicator has "own generator" for changing its parameters depending on the position in the strategy.

For example, if the program decides to modify Moving Average indicator and it is "Opening Logic Condition" and:
- it is the first indicator slot - it chooses between "single event signals":
   - Indicator changes its direction upwards
   - Indicator changes its direction downwards
   ...
- if it is second and further. It choses between "continues signals":
  - Indicator rises
  - Indicator falls
  ...

Something like that...

Lets say Express Generator is more clever than EA Studio, which is more clever than FSB Pro.

Re: Output of very similar strategies in a row

...and if it optimizes as Mr. Popov says, what target criteria is it optimizing for? Net profit? If so, it would be great if we could choose the criteria via the settings.ini (just like we can in EA Studio), because I always optimize for r-squared and don't care about net profit. This should make EG even more efficient for each users need.

Re: Output of very similar strategies in a row

By the way Mr. Popov, I just wanted to make it clear that all of this are suggestions at a level of a already superb great quality product that you have created. Express Generator is already now, by a huge margin, the best quant software I have ever used in the last 15 years that I am doing this in terms of speed, functionality and quality of the strategies. Thanks again for releasing it to us! :-)

Re: Output of very similar strategies in a row

As far as I understood your logic, the second strategy should at least differ a little bit (e.g. with a different exit indicator or slightly different periods) but it should not have 100% the same logic/settings?

It happens like that:
- The generator finds a strategy that passes all Acceptance Criteria. Pushes it to the collection. Then exports and clears the Collections.
- In the next loop, the Generator randomly chooses to add a new indicator. It may happen that with that new indicator the strategy does not pass.
- in the next loop, the Generator randomly decides to remove an indicator and remove the one that was added in the previous loop. Voila! A strategy that passes appears. It exports the same strategy as in the first step.

> It would otherwise mean that it wastes one calculation of a backtest for a strategy it already calculated one step ago.

Yes, it is.

Alternatively, we may store each strategy and check the list before calculating a new one. However, the list becomes huge very fast. Also checking a new "composed" strategy again all the list is not very much faster than the backtest itself.

Please note that Express Generator (as well as FSB Pro and EA Studio) calculates the indicators and keeps a cache of all indicator signals. It doesn't recalculate the indicator in a case as before.

Re: Output of very similar strategies in a row

> How does numerical parameter modification (optimization?) come into play?

Each indicator of the Express Generator has two functions:
- Generate - it generates a new logical condition proper for the particular slot, list parameters, and numerical parameters.
- Calculate - it calculates the signals of the indicator having the parameters from the Generate function and the data set.

Here is an example of the "Generate" function of MACD

        const indLogic: IndicatorLogic = IndCalc.getRandomIndicatorLogic(logicType)

        const applyTo    = ApplyTo.Close
        const fastPeriod = Helper.randomInteger(4, 24)
        const slowPeriod = Helper.randomInteger(fastPeriod + 1, 50)

Where

    public static getRandomIndicatorLogic(logicType: LogicConditionType): IndicatorLogic
    {
        return logicType === LogicConditionType.Single
            ? Helper.randomInteger(4, 7)
            : logicType === LogicConditionType.Continues
                ? Helper.randomInteger(0, 3)
                : Helper.randomInteger(0, 7)
    }

That is. There are no logical condition texts. Only indexes.

As you see the Express Generator always generates "slowPeriod" to be higher than "fastPeriod" of MACD. This is similar to EA Studio and not in FSB pro.

Currently, there is no Optimization / Normalization. I was not planning it, and I could not add it easily.

It is like designing the perfect cockpit of a sports car. Then the drivers ask for an Espresso machine in the cabin.
... It is always good t have an Espresso machine within reach, but we have to move the shifter slightly backwards and to the right. Hmmm...

Re: Output of very similar strategies in a row

> ...and if it optimizes as Mr. Popov says, what target criteria is it optimizing for? Net profit?

It is easy to add sorting methods for the Collection. I'll add several soon.
When I start working on Optimizer, I'll use add same sorting methods also.

Re: Output of very similar strategies in a row

Popov wrote:

That is. There are no logical condition texts. Only indexes.

I knew I was smart when I started to use indexes instead of long and error-prone texts in my indis big_smile

Re: Output of very similar strategies in a row

Thanks for the explanations Mr. Popov, that´s an extremely smart system you´ve created there, a true masterpiece to be honest. I am sure it can´t get any better than this and as you say, keeping a list of strategies would be too time-consuming as well, so redoing the same backtest is surely the better option indeed. Just was curious, but what you say explains it all.

The indicator cache is a super smart idea as well - wow!

Thanks again for this great work, it´s absolutely unique.

Have a nice weekend :-)

Posts: 14

Pages 1

You must login or register to post a reply

Forex Software → Express Generator → Output of very similar strategies in a row

Similar topics in this forum