Discussion of article "Machine learning in Grid and Martingale trading systems. Would you bet on it?" - page 3

 
Where can I see multiplier variants? For example, not by martin, but with different variants of lot increase at growth or decrease, stopping lot size change, hedging a lot of another sequence, and other variants.
 
1_lexa:
Where can I see the options of multipliers? For example, not by martin, but with different variants of lot increase at growth or decrease, stopping lot size change, hedging a lot of another sequence, and other variants.

GRID_COEFFICIENTS, GRID_DISTANCES, GRID_SIZE

the grid is assumed fixed here for all cases, and the machine learning algorithm generalises it to all situations. For hedging, you need to correct the markup and tester logic. Haven't done it.

 
Aleksey Vyazmikin:

Try to mark up not by profit, but by the number of open positions - where less is better.

I'll be able to see, there are a lot of options. When I finish another study, I'll try it

It's not hard to do, just change the markup condition.
 
Maxim Dmitrievsky:

we'll see, there's a lot of options. When I finish the other study, I'll try it

It's not hard to do, just change the markup condition.
def add_labels(dataset, min, max, distances, coefficients):
    labels = []
    for i in range(dataset.shape[0]-max):
        rand = random.randint(min, max)
        all_pr = dataset['close'][i:i + rand + 1]

        grid_stats = {'up_range': all_pr[0] - all_pr.min(),
                      'dwn_range': all_pr.max() - all_pr[0],
                      'up_state': 0,
                      'dwn_state': 0,
                      'up_orders': 0,
                      'dwn_orders': 0,
                      'up_profit': all_pr[-1] - all_pr[0] - MARKUP,
                      'dwn_profit': all_pr[0] - all_pr[-1] - MARKUP
                      }

        for i in np.nditer(distances):
            if grid_stats['up_state'] + i <= grid_stats['up_range']:
                grid_stats['up_state'] += i
                grid_stats['up_orders'] += 1
                grid_stats['up_profit'] += (all_pr[-1] - all_pr[0] + grid_stats['up_state']) \
                * coefficients[int(grid_stats['up_orders']-1)]
                grid_stats['up_profit'] -= MARKUP * coefficients[int(grid_stats['up_orders']-1)]

            if grid_stats['dwn_state'] + i <= grid_stats['dwn_range']:
                grid_stats['dwn_state'] += i
                grid_stats['dwn_orders'] += 1
                grid_stats['dwn_profit'] += (all_pr[0] - all_pr[-1] + grid_stats['dwn_state']) \
                * coefficients[int(grid_stats['dwn_orders']-1)]
                grid_stats['dwn_profit'] -= MARKUP * coefficients[int(grid_stats['dwn_orders']-1)]
        
        if grid_stats['up_orders'] < grid_stats['dwn_orders'] and grid_stats['up_profit'] > 0:
            labels.append(0.0)
            continue
        elif grid_stats['dwn_profit'] > 0:
            labels.append(1.0)
            continue
        
        labels.append(2.0)

    dataset = dataset.iloc[:len(labels)].copy()
    dataset['labels'] = labels
    dataset = dataset.dropna()
    dataset = dataset.drop(
        dataset[dataset.labels == 2].index).reset_index(drop=True)
    return dataset

Yellow - change the condition

result (study from 2020.05)

These conditions are easy to change at will, you can add time filters (see the previous article) or others.

It is possible to find settings, at which the bot is almost unkillable since 2010 and earlier (if you work with drawdowns in a couple of cases).

There are still a lot of trades

Perhaps we should make a search of parameters, by analogy with the previous article.

 
Maxim Dmitrievsky:

Yellow - change the condition

result (training from 2020.05)

These conditions can be easily changed as desired, you can add time filters (see previous article) or other filters.

It is possible to find settings, at which the bot is almost unkillable since 2010 and earlier (if you work with drawdowns in a couple of cases).

There are still a lot of trades

Perhaps we should make a search of parameters, by analogy with the previous article.

It seems to be better.

For me, the point of training on the model grid is to make a decision on the expediency of opening a position at a particular level or skipping this signal. And for this purpose, the model should evaluate the closing of the aggregate position as a profit when the closing point is reached. If there will be profit, there is no sense to open a position. For this purpose it is necessary to estimate the price value at the moment of position closing.

 
Aleksey Vyazmikin:

That's kind of better.

For me, the point of training on the grid model is to make a decision about the expediency of opening a position at a particular level or skipping this signal. And for this purpose, the model should evaluate the closing of the aggregate position for profit when the closing point is reached. If there will be profit, there is no sense to open a position. For this purpose it is necessary to estimate the price value at the moment of position closing.

So not bad, yes, it remains to work out the variant with working on a longer history. For example, it does not work in crises with a strong fall, because there were no such examples during training.

 
Maxim Dmitrievsky:

So not bad, yes, it remains to work out the variant with work on a longer history. For example, it does not work in crises with a strong fall, because there were no such examples during training.

If one seeks to survive in a crisis, the total gain will be much smaller than for periods before and after the crisis. It is a philosophical question, whether to lose a part of the depo in the crisis and earn many times more than what was lost before and after the crisis, or to have a chance not to drain in the crisis, but to earn 3-5 times slower.

You need dynamic levels, at least, to survive on large movements.

 
Aleksey Vyazmikin:

If you strive for survival in the crisis, the total gain will be much less than in the periods before and after the crisis. It is a philosophical question, whether to lose part of the depo in the crisis and earn many times more than what was lost before and after the crisis, or to have a chance not to drain in the crisis, but to earn 3-5 times slower.

You need dynamic levels, at least, to survive on large movements.

If we approximate the crisis+quiet market, then yes, it is tight on standard chips, we need either this or that. Or look for compromises.

 
Aleksey Vyazmikin:

That's kind of better.

For me, the point of training on the grid model is to make a decision about the expediency of opening a position at a particular level or skipping this signal. And for this purpose, the model should evaluate the closing of the aggregate position for profit when the closing point is reached. If there will be profit, there is no sense to open a position. For this purpose it is necessary to estimate the price value at the moment of position closing.

I don't get it, in this case is it a grid at all? If the forecast gives that there will be no profit - then by all means it is necessary to close, and not to think about opening or not. And in a grid you should open anyway.

Because the grid is just trying to win the distance to move the closing point to a more probable one with the same profit.

Well, if you want to bother with the grid, you should build a matrix of outcomes, and correct it by Bayes with each new price movement, i.e. with a new forecast.

 
Aleksey Mavrin:

I don't get it, in this case is it a grid at all? If the forecast gives that there will be no profit - then by all means you should close, and not think about opening or not. And in a grid you should open anyway.

Because the grid is just trying to win the distance to move the closing point to a more probable one with the same profit.

Well, if you want to bother with the grid, you should build a matrix of outcomes, and correct it by Bayes with each new price movement, i.e. with a new forecast.

This was the goal, to find other setups that are impossible without a grid