Is there a pattern to the chaos? Let's try to find it! Machine learning on the example of a specific sample. - page 5

 
elibrarius #:
We need an accurate financial result from errors. Without them the balance line is unreliable.
Fin. res. if we choose 0 (you can not include, it will always be 0), if 1, if -1. Always, even if you mark as 0 class do not trade. The model will be wrong and it is necessary to know the price of the error.

It is not the model that determines the direction of entry, so if there is an error with the direction, there will be no entry and therefore no loss.

 
Aleksey Vyazmikin #:

It is not the model that determines the direction of entry, so if there is a mistake with the direction, there will be no entry and therefore no loss.

I wrote about 0 class, which will sometimes be predicted 1 or -1. You wrote about it that the financial result is unknown.

 
Aleksey Vyazmikin #:

It is not the model that determines the direction of entry

If it is not the model that determines it, then there is no need to teach it.

 
elibrarius #:

I wrote about the 0 class, which will sometimes be predicted to be 1 or -1. You wrote about him that the financial result is unknown.

Just don't give up the direction.

If the class is zero and the direction is +1 and was classified as 1, there will be a loss - take any column with the financial result modulo.

If the class is zero and the direction is +1, but was classified as -1, then there will be no entry and no loss.

If the class is zero and the direction is -1, and was classified as -1, there will be a loss - take any column with the financial result modulo.

If the class is zero and the direction is -1 and was classified as 1, there will be no entry, there will be no loss.

elibrarius #:

If it's not the model that determines it, there's no reason to teach it.

The logic here is simple - a number of predictors, or even their values, gravitate more towards a particular direction of price movement. When we teach everything together by class 1 and 0, we are essentially selecting predictors that determine a strong movement in any of the directions - and there are usually not many of them, but if we give each direction its own class, some statistical contradictions will disappear and the model can already include indicators of one predictor at different ends of its value, for example RSI 70/30 can easily separate.

In theory, class zero is flat, so it should be similar enough for each direction. Again, I divided the sample into two parts at once - by entry direction and it improved the results of learning - i.e. a higher percentage of models met the criterion of profit threshold.

 
Aleksey Vyazmikin #:

If the class is zero and the direction is +1 and it was classified as -1, there will be no entry, no loss.

The teacher may not enter. But the model will make a mistake and enter the market. The model does not know about 0 and +1 from the teacher, it received -1 forecast and will trade

 
elibrarius #:

The teacher might not enter. But the model will make a mistake and enter the market. Or do you have a conditional operator that forbids the model to trade as it predicted? I'm afraid I have nowhere to put such an operator to build a balance.

At the moment there is no operator, but there are data for it and they are written in the "Target_P" column - so everything can work quite successfully.

Here is an example of the code logic I have sketched out for building the balance

int Prognoz=0;//Сюда запишем прогноз
int Target_100[];//Фактическая целевая
int Target_P[];//Тип сделки - покупка/продажа
double Target_100_Buy[];//Финансовый результат от покупки
double Target_100_Sell[];//Финансовый результат от продажи
double Fin_Rez[];//Финансовый результат
int Strok_Total=0;//Всего строк
int Index_Fin_Rez=1;//Считаем число классифицированных 1 и -1 - это размер массива баланса и индекс массива Fin_Rez
ArrayResize(Target_100,Strok_Total);
ArrayResize(Target_P,Strok_Total);
ArrayResize(Target_100_Buy,Strok_Total);
ArrayResize(Target_100_Sell,Strok_Total);
ArrayResize(Fin_Rez,Strok_Total);
ArrayInitialize(Fin_Rez,0);
/*
Прочли данные файла в массивы - не знаю как реализовано у Вас
*/
for(int i=0; i<Strok_Total; i++)
{
/*
Сделали прогноз
*/
   if(Prognoz==-1 && Target_P[i]==-1)
   {
      Fin_Rez[Index_Fin_Rez]=Fin_Rez[Index_Fin_Rez-1]+Target_100_Sell[i];
      Index_Fin_Rez++;
   }
   if(Prognoz==1 && Target_P[i]==1)
   {
      Fin_Rez[Index_Fin_Rez]=Fin_Rez[Index_Fin_Rez-1]+Target_100_Buy[i];
      Index_Fin_Rez++;
   }
}
ArrayResize(Fin_Rez,Index_Fin_Rez);
 
Aleksey Vyazmikin #:

At the moment there is no operator, but there is data for it and it is written to the "Target_P" column - so everything can work quite well.

Here is an example of the code logic I sketched out to build the balance

The model should only trade according to the forecast. If you calculate the result using the teacher - this is peeking into the future. Trading should be only by forecast. You will not have Target_100_Sell in the real future.

The model does not know about 0 and +1 from the teacher, it got -1 forecast and will trade. You only need to know the financial result of each forecast variant.

 
elibrarius #:

The model should only trade according to the forecast. If you calculate the result using the teacher, it is peeking into the future. Trading should be by forecast only.

The model does not know about 0 and +1 from the teacher, it got -1 forecast and will trade. You only need to know the financial result of each forecast variant.

What's peeking got to do with it. We change the target to improve learning, not to change the logic of the EA. The logic is that we know the direction for entry without the model, and the model should tell us whether we should enter or not.

 
Aleksey Vyazmikin #:

and the model should tell you whether to go in or not.

We've already checked that.

 
elibrarius #:

We've already checked that out.

Look, we have entry points - sample lines, and we have a financial result defined by exit points, namely the places where a stop loss or other signal is set. You want to enter the market contrary to the strategy, i.e. buy where you should sell, if the model says so, and for this you need to define new exit points. The question arises, if the exit point has not appeared yet, but the entry point has appeared, what should you do then - close and ask the model about the entry direction, or what?

Reason: