learn how to earn money villagers [Episode 2] ! - page 157

 
That's the point, I would like to get rid of the fixed distance between fills and make them dynamic, and close when the opposite line is crossed (when the signal is reversed)
 
BeerGod:
The point is that I want to get rid of the fixed distance between toppings, and make them dynamic, and close at crossing the opposite line (at opposite signal)

I have made a dynamic channel width depending on the ATR indication. So far I've been using this (reversed) Avalanche-type scheme (reversed martin) on micro-real, along with Ilan with settings from this branch. Haven't tested THAT scheme in ilan yet. My entry is not by bollinger, but by OSMA indicator.

For Ilan - the averaging tool, you can make a start entry by the bollinger bars...

The code calculates the averaging channel width, upon reaching which the averaging is performed on increased volumes:

extern int Period_ATR = 30;       // значение АТР для расчета динамического канала
extern double Mul_TP = 4.0;       // множитель целевой  прибыли в единицах волатильности (АТР)
extern double Mul_Sl = 0.8;       // множитель защитной  остановки с последующим производством усреднения позиции при ее сработке уже 
                                  // увеличенным лотом в единицах волатильности (АТР)
... 
//-----------------------------------------------------расчет динамического канала----------------------------    
    if (Symbol() == "GBPJPY" || Symbol() == "EURJPY" || Symbol() == "USDJPY" || Symbol() == "CHFJPY" ||  Symbol() == "NZDJPY" 
        ||  Symbol() == "USDRUR") 
         {                 
           channel = (iATR(Symbol(),PERIOD_D1,Period_ATR,1)*1000)*Mul_Sl;                 
           StopLossPips = NormalizeDouble(channel,0);                                                                                                         
         }       
    else
         {                 
           channel = 10* (iATR(Symbol(),PERIOD_D1,Period_ATR,1)*10000/3)*Mul_Sl;                 
           StopLossPips = NormalizeDouble(channel,0);                                                                                                         
         }               
          
    if (Symbol() == "XAGUSD")  // || Symbol() == "EURGBP")   StopLossPips = StopLoss;    // т.к. волатильность (по АТР) другая (выше)
         {                 
           channel = (iATR(Symbol(),PERIOD_D1,Period_ATR,1)*100)*Mul_Sl;                 
           StopLossPips = NormalizeDouble(channel,0);                                                                                                         
         }       
     if (Symbol() == "XAUUSD")  // || Symbol() == "XAUUSD" || Symbol() == "EURGBP")   StopLossPips = StopLoss;    // т.к. волатильность (по АТР) другая (выше)
         {                 
           channel = (iATR(Symbol(),PERIOD_D1,Period_ATR,1)*100)*Mul_Sl;   // Большая волатильность, поэтому умножение на 10.              
           StopLossPips = NormalizeDouble(channel,0);                                                                                                         
         }             
       
     TakeProfitPips=NormalizeDouble(StopLossPips*Mul_TP,0);  // расчет уровня тейка для всех инструментов по заданному значению динамического стопа        
                          
 

Thanks, I'll experiment. Generally speaking, it works if you refill sensibly.


 
BeerGod:

Thanks, I'll experiment. Generally there is a use if you do the refills sensibly.


You're welcome. Sure! IMHO!

We're not talking about refills here, we're talking about averages - that's if you're thinking about Elan-like exps... :-)

As soon as I optimize the external variables and prepare a live version for the real world, I'll post a report!

I can also make a starter entry on the bollinger strips...

 
I decided to write my "Illan" from scratch, it's a risky trade, but the risk is justified, I decided to use bollejder for entry and now I have to make a wise averaging to keep the system on the minimum deposit.
 
BeerGod:
I decided to write my "Illan" from scratch, it's a risky trade, but the risk is justified, I decided to use bollejder as an entry point, now I have to make a wise averaging, so the system will work with minimal deposit.

I will transfer the averaging schemes from my Avalanche (reversal and additive) one-to-one on Ilan (averaging price of poses), and I will use variants. I may also do a starter on Bollinger... For now on OSME.

I have a code like this:

extern int Max_Iteration = 36;    // Максимальное количество итераций (ордеров) в мартине 
extern int k = 2;                 // с какой итерации тралим
extern int VAR_MM = 0;            // используемый вариант MM в соотв-ии:
                                  // 0 = множитель с числами ФИБО; 
                                  // 1 - по Илану в соответствие с LotExponent 
                                  // 2 - классический мартин - удвоение предыдущего объема
                                  // 3 - мн по ар-ой прогрессии 
                                  // 4 - мартин по схеме домножения предпредыдущего объёма на 2, т.е. 1,2,3,4,6,8,12,16,24,32
extern double LotExponent = 1.1;  // на сколько умножать стартовый лот в степени - схема по Илану          
....
 if (Iteration <= Max_Iteration && VAR_MM == 0)                  
              // Последующие лоты открываются по множителю в соответствие с числами ФИБО           
               switch(Iteration)                                  // Заголовок switch 
                   {                                              // Начало тела switch                  
                     case 1 : Lots_New = lastLots * 1; lots = lastLots; Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );break; //расчет нового объема       
                     case 2 : Lots_New = lots * 2;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;   
                     case 3 : Lots_New = lots * 3;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;      
                     case 4 : Lots_New = lots * 5;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;  
                     case 5 : Lots_New = lots * 8;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;     
                     case 6 : Lots_New = lots * 13;   Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;      
                     case 7 : Lots_New = lots * 21;   Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;     
                 ...
                     case 19: Lots_New = lots * 6765; Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;                                                   
                     case 20: Lots_New = lots * 10946;Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;                           
                     default: Lots_New = lots * 17711; {Iteration = 0; Print("Выход за пределы. Iteration = ", Iteration, " Lots_New = ", Lots_New ); }                      
                   }                                    // Конец тела switch      
                    
           if (Iteration <= Max_Iteration && VAR_MM == 1)
              //Последующие лоты открываются по ИЛАНУ через экспоненту: iLots = NormalizeDouble(Lots * MathPow(LotExponent, NumOfTrades), lotdecimal);
               switch(Iteration)                        // Заголовок switch 
                   {                                    // Начало тела switch    
                  // case 0 : Lots_New = lots;  Print("старт, Lots_New = ", Lots_New );break; // СТАРТ                
                     case 1 : Lots_New = lastLots * 1; lots = lastLots; Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );break; //расчет нового объема                                                                                                                        
                     // расчет последующих объемов, открываемых позиций, начиная с объема ПЕРВОЙ-case 1
                     default: Lots_New = lots * MathPow(LotExponent, Iteration); Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);                                                                    
                   }                                   // Конец тела switch  
                
          if (Iteration <= Max_Iteration && VAR_MM == 2)// Последующие лоты открываются в соответствие с классическим мартином - удвоение           
               switch(Iteration)                       // Заголовок switch 
                   {                                   // Начало тела switch                       
                     case 1 : Lots_New = lastLots * 1; lots = lastLots; Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );break; //расчет нового объема       
                     case 2 : Lots_New = lots * 2;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;   
                     case 3 : Lots_New = lots * 4;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;      
                ...                                                    
                     case 16: Lots_New = Lots * 32768;Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;
                     case 17: Lots_New = Lots * 65536;Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;                                                                  
                     default: Lots_New = lots * 65536; {Iteration = 0; Print("Выход за пределы. Iteration = ", Iteration, " Lots_New = ", Lots_New ); }                      
                   }                          
                   
         if (Iteration <= Max_Iteration && VAR_MM == 3)// Последующие лоты открываются в соответствие с членами ар прогрессии           
               switch(Iteration)                       // Заголовок switch 
                     {                                 // Начало тела switch         
                     case 1 : Lots_New = lastLots * 1; lots = lastLots; Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );break; //расчет нового объема            
                     case 2 : Lots_New = lots * 3;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );  break;   
                     case 3 : Lots_New = lots * 5;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );  break;      
                     case 4 : Lots_New = lots * 7;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );  break;  
                     case 5 : Lots_New = lots * 9;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );  break;     
                ...
                     
                     case 57: Lots_New = lots * 113;  Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );  break; 
                     case 58: Lots_New = lots * 115;  Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );  break;        
                     default: Lots_New = lots * 117;  {Iteration = 0; Print("Выход за пределы. Iteration = ", Iteration, " Lots_New = ", Lots_New ); }                       
                   }                                   // Конец тела switch                                                      
              
               if (Iteration <= Max_Iteration && VAR_MM == 4) // мартин по схеме домножения предпредыдущего объёма на 2, т.е. 1,2,3,4,6,8,12,16,24,32             
               switch(Iteration)                       // Заголовок switch 
                   {                                   // Начало тела switch                       
                     case 1 : Lots_New = lastLots * 1; lots = lastLots; Print("Iteration = ", Iteration, " Lots_New = ", Lots_New );break; //расчет нового объема       
                     case 2 : Lots_New = lots * 2;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;   
                     case 3 : Lots_New = lots * 3;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;      
                     case 4 : Lots_New = lots * 4;    Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;  
                   ...  
                    
                     case 31: Lots_New = lots * 49152;Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;
                     case 32: Lots_New = lots * 65536;Print("Iteration = ", Iteration, " Lots_New = ", Lots_New);  break;
                     default: Lots_New = lots * 98304;{Iteration = 0; Print("Выход за пределы. Iteration = ", Iteration, " Lots_New = ", Lots_New ); }  
                   }                          
      
 
Thanks for the codes, they give me an idea, although I'll rewrite the code to fit my logic, I should experiment with dynamic averaging, then miracles are possible) The system has the potential... Yes, it's one part of the story, but it's all about the averaging distance (the right calculation)
 
Does it work on history? Maybe it's time to go to the source of the quotes?
 
 
rentik:

HELLO, villagers!!!

https://www.mql5.com/ru/forum/142073/page2


Priva!

Congratulations on the birth of your daughter!

Well done!

Reason: