Difference calculus, examples. - page 14

 
Aleksey Panfilov:

I have experience of creating a balance indicator, will it come close to creating a hyperparameter?

I'm not sure, if there is no real correlation, it may not help... in fact, this is the question that everyone is puzzling over in the MO :)

 
Maxim Dmitrievsky:

I'm not sure if there is no real correlation, it may not help... in fact, this is the question that everyone is puzzling over in the MO :)

:)

Just in case, a picture, the balance indicator (bottom window).

Steady steps balance, green line means.

 
Aleksey Panfilov:

:)

Just in case, a picture, the balance indicator (bottom window).

A smooth balance step, green means line.

Oooh!

+

 
Aleksey Panfilov:

:)

Just in case, a picture, the balance indicator (bottom window).

The balance is not an absolute value, but, for example, the profit factor is current.

Balance is not needed in absolute values, but, for example, the current profit factor... i.e. to normalize the chart somehow

then it is already possible to link this variable with the rest somehow, for example, through fuzzy logic or a neuron

 

R^2 would be a great help

https://www.mql5.com/ru/articles/2358

R-квадрат как оценка качества кривой баланса стратегии
R-квадрат как оценка качества кривой баланса стратегии
  • 2017.10.24
  • Vasiliy Sokolov
  • www.mql5.com
Каждая торговая стратегия нуждается в объективной оценке ее эффективности. Для этого используется обширный ряд статистических параметров. Многие из них просты в расчете и показывают интуитивно понятные метрики. Другие сложнее в построении и в интерпретации значений. Несмотря на все это многообразие, есть очень мало качественных метрик для...
 

Then, add your indicators and R^2 as input terms, then linguistically describe rules of interaction between variables and get signal on output

this is just an example, you can also use neuron (there are articles too), but fuzzy logic seems to me more flexible and intuitive for these tasks, and it also can be optimized as a neuron or your parameters, but there will be less intents

https://www.mql5.com/ru/articles/3795

Нечеткая логика в торговых стратегиях
Нечеткая логика в торговых стратегиях
  • 2017.09.18
  • Maxim Dmitrievsky
  • www.mql5.com
Трейдеры часто задаются вопросом о том, как улучшить торговую систему или создать новую за счет машинного обучения. Несмотря на обилие публикаций, остается открытым вопрос о простом и интуитивно понятном способе создания моделей, которые невозможно аналитически просчитать без использования компьютерных вычислений. Нечеткая логика — это окно в...
 

Thanks for the messages.

Unfortunately, at the moment, I am not familiar with machine learning. And I am not going to master it in the near future.

I was planning to use the balance indicator for rapid continuous optimization. Unfortunately, I have to develop an analogue of the balance indicator and a script to search parameters for each Expert Advisor. I think it is realistic to include these algorithms in the robot for automated optimization. In general, it is probably the same machine learning but on a self-made level.

Perhaps I will get around to it, too.

In the meantime, I have something that may be useful to someone. Balance Indicator for MT4.

int start()
  {
  
   int    i;
   int    counted_bars=IndicatorCounted();
//----
   if(Bars<=3 ) return(0);
   if (PRED_CHISLO_BAROV == Bars) return(0);
 
   i=Bars-1;// i присваиваем значение числа баров  .
   if(counted_bars>1) i=Bars-counted_bars-1;// 
   while(i>=0)                                
     {

//================================================================================================================================================================================================
   MacdCurrent = iCustom( NULL, 0, "_________________",
                                                           0,i);
   MacdPrevious = iCustom( NULL, 0, "_______________",
                                                         0,i+1);

   SignalCurrent = iCustom( NULL, 0, "_____________",
                                                         1,i); 
   SignalPrevious = iCustom( NULL, 0, "_____________",
                                                         1,i+1);
                                                          
   MacdCurrent_Trend = iCustom( NULL, 0, "______________",
                                                            0,i); 
   MacdPrevious_Trend = iCustom( NULL, 0, "___________________",
                                                          0,i+1);

   SignalCurrent_Trend = iCustom( NULL, 0, "__________________",
                                                          1,i); 
    if(Trend_InpSignalSMA==0) SignalCurrent_Trend = 0; 


   SignalPrevious_Trend = iCustom( NULL, 0, "_______________",
                                                          1,i+1);
     if(Trend_InpSignalSMA==0) SignalPrevious_Trend = 0; 
                                                         
//================================================================================================================================================================================================
//  Оцениваем в какой позиции мы стояли бы по трендовому MACD  И назначаем Trend =1 восходящий =-1 низходящий

    if( 
  MacdPrevious_Trend < 0    &&                                                             //1) основная линия MACD ниже 0
  MacdCurrent_Trend > SignalCurrent_Trend && MacdPrevious_Trend < SignalPrevious_Trend &&  //2)  основная линия только что пересекла сигнальную с низу в верх
  MathAbs(MacdPrevious_Trend) > (Trend_MACDOpenLevel*Point)                                //3) основная линия ниже заданного для открытия значения 
      )                                                             Trend =1;

    if( 
  MacdPrevious_Trend > 0     &&                                                           // 1) основная линия MACD выше 0
  MacdCurrent_Trend < SignalCurrent_Trend && MacdPrevious_Trend > SignalPrevious_Trend && //-  основная линия только что пересекла сигнальную с низу в верх
  MathAbs(MacdPrevious_Trend) > (Trend_MACDOpenLevel*Point)                               // - основная линия выше заданного для открытия значения 
      )                                                             Trend =-1;

//================================================================================================================================================================================================
//РАСЧЕТ ЛИНИИ БАЛАНСА.

// Закрываем позицию SELL
    if(
  (  
   Posic == -1 &&                                                // Если открыта позиция SELL 
  MacdPrevious < 0  &&                                            // 1) основная линия MACD ниже 0
  MacdCurrent > SignalCurrent && MacdPrevious < SignalPrevious && //-  основная линия только что пересекла сигнальную с низу в верх
  MathAbs(MacdPrevious) > (Ind_MACDCloseLevel*Point)              // - основная линия ниже заданного для закрытия значения 
  ) || (
  Posic == -1 && (Cena_0 - Open[i])/Point * Naprav >= TakeProfit
  ) || (
  Posic == -1 && (Open[i] - Cena_0)/Point * Naprav >= StopLoss
  )
      )                                              
  {  
    if( Cena_0 > 0 ) Balans = Balans +(Cena_0 -Open[i])/Point * Naprav  ; 
        Cena_0 = 0;             Posic = 0;   Capital = 0 ;
  }

// Открываем позицию BUY
    if(
  Trend == 1 &&
  Posic == 0 &&                                                   // Если позиция зарыта
  MacdPrevious < 0   &&                                           // 1) основная линия MACD ниже 0
  MacdCurrent > SignalCurrent && MacdPrevious < SignalPrevious && //-  основная линия только что пересекла сигнальную с низу в верх
  MathAbs(MacdPrevious) > (Ind_MACDOpenLevel*Point)               // - основная линия ниже заданного для открытия значения 
      )
      {   Cena_0 = Open[i];     Posic = 1;  Balans = Balans - Spred; }


// Закрываем позицию BUY
    if(
  (
  Posic == 1 &&                                                    // Если открыта позиция BUY
  MacdPrevious > 0  &&                                             // 1) основная линия MACD выше 0
  MacdCurrent < SignalCurrent && MacdPrevious > SignalPrevious &&  //-  основная линия только что пересекла сигнальную с  верх в низу 
  MathAbs(MacdPrevious) > (Ind_MACDCloseLevel*Point)               // - основная линия выше заданного для закрытия значения 
  ) || (
  Posic == 1 && (Cena_0 - Open[i])/Point * Naprav >= StopLoss
  ) || (
  Posic == 1 && (Open[i] - Cena_0)/Point * Naprav >=  TakeProfit
  )
      )                                               
  {  
    if( Cena_0 > 0 ) Balans = Balans +(Open[i] - Cena_0)/Point * Naprav ; 
        Cena_0 = 0;             Posic = 0;   Capital = 0 ;
  }


// Открываем позицию SELL
    if(
  Trend == -1 &&
  Posic == 0 &&                                                    // Если  позиция зарыта
  MacdPrevious > 0 &&                                              // 1) основная линия MACD выше 0
  MacdCurrent < SignalCurrent && MacdPrevious > SignalPrevious  && //-  основная линия только что пересекла сигнальную с  верх в низу 
  MathAbs(MacdPrevious) > (Ind_MACDOpenLevel*Point)                // - основная линия выше заданного для открытия значения 
      ) 
      {   Cena_0 = Open[i];     Posic = -1;  Balans = Balans - Spred;  }
      
    a1_Buffer[i]= Balans;
//================================================================================================================================================================================================
//РАСЧЕТ ЛИНИИ ТЕКУЩЕГО КАПИТАЛЛА.

// При открытой позиции BUY
    if(   Posic >  0  ) 
  {  
    if( Cena_0 > 0 ) Capital = ((Open[i] - Cena_0)/Point * Naprav) ; 
  }
// При открытой позиции SELL
    if(  Posic <  0   ) 
  {  
    if( Cena_0 > 0 ) Capital = ((Cena_0 -Open[i])/Point  * Naprav) ; 
  }                       
    a2_Buffer[i]=   Balans + Capital;
//================================================================================================================================================================================================
//    a3_Buffer[i]= 
//================================================================================================================================================================================================
//    a4_Buffer[i]=
//================================================================================================================================================================================================
//================================================================================================================================================================================================
    if (i >= Bars-(TOCHKA_VHODA*2)) Cena_0 = 0;// 

      i--;       PRED_CHISLO_BAROV = Bars;                                
     } 
//----
   return(0);
  }
//+------------------------------------------------------------------+


P/S. I would be grateful if you could add some examples of similar indicators. It would be better together with the Expert Advisor it copies.

 
ah, you're a paracha, that would be a real-time option... same thing
 
Aleksey Panfilov:

And without the slang? :))))))

Calculate the balance graph by the current parameters for a certain depth of history, and if it is bad, then correct them live, and watch the curve again... until it becomes optimal, then trade until it starts to deteriorate again, and then go through the parameters again... Backtest will of course be long in this case

 
Aleksey Panfilov:

Thank you.

But there will be a million handles, I will have to rewrite all the indicators in the Expert Advisor body

Reason: