[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 355

 
FelixFX:



But then the array must be 7-dimensional?

for (g=0;g<=100000;g++){

for (a=0;a<=100;a++){

for (b=0;b<=100;b++){ 

jaw_val1=iMA(NULL, 0, a, b, MODE_SMMA, PRICE_MEDIAN, g);

if (jaw_val1<=Close[g]) continue;

for (c=0;c<=100;c++){

for (d=0;d<=100;d++){

jaw_val2=iMA(NULL, 0, c, d, MODE_SMMA, PRICE_MEDIAN, g); 

if (jaw_val2<=Close[g]) continue;

for (e=0;e<=100;e++){

for (f=0;f<=100;f++){

jaw_val3=iMA(NULL, 0, f, e, MODE_SMMA, PRICE_MEDIAN, g); 

if (jaw_val3>Close[g]) sum=sum+(High[g]-Low[g]); 

}}}}}}}   
Optimisation Light.
 
Can you please tell me how to request the maximum of the last fractal?
 
nadya:
Can you please tell me how to request the maximum of the last fractal?

Middle of this page.
 
Roman.:

Middle of this page.
Thank you!
 
How do I use PostMessageA to turn off an EA? (Press the Advisors button)
 
nadya:
Can you please tell me how to request the maximum of the last fractal?
The last fractal is the only fractal. And if it is the only fractal, it is both the maximum and the minimum, as there is nothing else to compare it with.
 
serler2:
How do I use PostMessageA to turn off an EA? (Press the Advisors button)

Library.

Next:

// 5. Функция включения/отключения эксперта.
void ExpertEnabled(bool bSwitch) // TRUE - включить эксперт, FALSE - отключить эксперт.
 {
  if (bSwitch) {if (!IsExpertEnabled()) ServiceSetExperts();} // Если требуется разрешить работу эксперта. Разрешаем работу экспертов, если она была запрещена.
  else {if (IsExpertEnabled()) ServiceSetExperts();} // Если требуется запретить работу эксперта. Запрещаем работу экспертов, если она была разрешена.
 }
 
splxgf:
Optimization Light.


Thank you! But

for (g=0;g<=100000;g++){

by the condition of the tasks being executed, must necessarily be the last loop.

 
FelixFX:


Thank you! But

for (g=0;g<=100000;g++){

by the condition of the tasks to be performed must necessarily be the last loop.

There is no such dependence in your code sample. Another example will give you another solution. That's what optimization is all about.

 

Good afternoon!

I am self-taught and this is my first steps in programming.

I am creating an indicator for educational and practical purposes.

When developing trading criteria in Expert Advisors, it is more convenient to use ready-made indicators.

In this indicator I also try to combine several indicators (composed).

But it doesn't work: the terminal hangs and does not render it correctly.

What am I doing wrong? Please help me.

I want to receive comments, criticism, corrections, recommendations, but not ridicule (no one is born an ace ... and everyone has been down this road).

The indicators we are addressing are custom indicators. Everything is OK with them - they work correctly.

If you need clarification, I am ready to help.

/**********************************************************/
// Иникатор ME_Proboy_F5_Complex_v3.mq4
// Комплексный индикатор включающий в себя анализ
// - Нахождение сигнала пробоя линии построенной по Frac5-5;
// - Выставление ордеров;
// - Времени жизни ордеров;
// - Cрабатывание ордера;
// - Срабатывание стопа;   
// - Срабатывание профита; 
//
// Данный индикатор отображает значение ордеров (Buy, Sell) как графически,  
// 
//-----         
// 2.period_Teni  - определяет за какой период будет расчитываться средняя тень. 
//-----         
// 4.min_order - минимально допустимое расстояние от экстремума свечи до ордера  
//               в пунктах.  
// 5.koef_R     =    1.5;  
//-----         
#property indicator_separate_window 

#property indicator_buffers       8         
#property indicator_color1        Blue  
#property indicator_color2        DeepPink
#property indicator_color3        Blue
#property indicator_color4        DeepPink 
#property indicator_color5        LightPink    
#property indicator_color6        LightPink  
#property indicator_color7        LightGreen  
#property indicator_color8        LightGreen  

#property indicator_maximum  4         //верхнее ограничение шкалы отдельного окна индикатора 
#property indicator_minimum -4        //нижнее ограничение шкалы отдельного окна индикатора 
#property indicator_level1 0.0         //горизонтальный уровень N в отдельном окне индикатора, где N от 1 до 8 
#property indicator_levelcolor Silver // цвет горизонтальных уровней индикатора 
#property indicator_levelwidth 1      //толщина горизонтальных уровней индикатора 


// -------------------- Для обращения к индикатору пробоя фрактала 5 ----------------
extern   int       T_Life_CDL        =  0;                         // Ограничительная область в 5 ть свечек                                                               
extern   bool      Img_UP_DW         =  true;                      // Рисовать или нет линии по понижающимся верхним фракталам
extern   color     Color_UP_D        =  Lime;                      // Цвет линий по верхним фракталам                                                                
extern   bool      Img_DW_UP         =  true;                      // Рисовать или нет линии по повышающимся нижним фракталам
extern   color     Color_DW_UP       =  DeepPink;                      // Цвет линий по нижним фракталам
// -------------------- Для обращения к индикатору конвертов ----------------
extern   int       mode_MA           =  1;        //усреднение                
extern   int       price_MA          =  0;        //цена для расчёта МА
extern  double     period_MA         =  120;
extern  double     period_ATR        =  12; 
extern  double     k_step_ATR        =  1.0;      
// -------------------- Для обращения к индикатору уровня ордера ---------------- 
extern  int        period_Teni       =  12;
//extern  int        period_ATR        =  12;  
extern  double     min_order         =  0;   
extern  double     koef_R            =  1.5;  
extern  bool       text              =  false; 
extern  int        T_Life_ORD        =  2;
//--------------------------------------------
        double     spred;
        int        O_Buy,
                   O_Sel,
                   D_Buy,
                   D_Sel,
                   S_Buy,
                   S_Sel,
                   P_Buy,
                   P_Sel;
//-------------------------------------------------------------------

double Order_Buy[]; 
double Order_Sel[];
double Deal_Buy[]; 
double Deal_Sel[];
double Stop_Buy[];
double Stop_Sel[];
double Profit_Buy[];
double Profit_Sel[]; 

//+===========================================================================+ 
int init()  
   { 
     SetIndexBuffer (0, Order_Buy); 
     SetIndexStyle  (0, DRAW_HISTOGRAM, STYLE_SOLID, 2); 
     SetIndexLabel  (0,"Ордер Buy");
    //-----         
     SetIndexBuffer (1, Order_Sel);  
     SetIndexStyle  (1, DRAW_HISTOGRAM, STYLE_SOLID, 2); 
     SetIndexLabel  (1,"Ордер Sell");
     
     SetIndexBuffer (2, Deal_Buy); 
     SetIndexStyle  (2, DRAW_HISTOGRAM, STYLE_SOLID, 4); 
     SetIndexLabel  (2,"Покупка");
    //-----         
     SetIndexBuffer (3, Deal_Sel);  
     SetIndexStyle  (3, DRAW_HISTOGRAM, STYLE_SOLID, 4); 
     SetIndexLabel  (3,"Продажа");
     
     SetIndexBuffer (4, Stop_Buy); 
     SetIndexStyle  (4, DRAW_HISTOGRAM, STYLE_SOLID, 6); 
     SetIndexLabel  (4,"Стоп Buy");
    //-----         
     SetIndexBuffer (5, Stop_Sel);  
     SetIndexStyle  (5, DRAW_HISTOGRAM, STYLE_SOLID, 6); 
     SetIndexLabel  (5,"Стоп Sell");
     
     SetIndexBuffer (6, Profit_Buy);  
     SetIndexStyle  (6, DRAW_HISTOGRAM, STYLE_SOLID, 6); 
     SetIndexLabel  (6,"Профит Buy");
     
     SetIndexBuffer (7, Profit_Sel);  
     SetIndexStyle  (7, DRAW_HISTOGRAM, STYLE_SOLID, 6); 
     SetIndexLabel  (7,"Профит Sell");
     IndicatorShortName ("Сделка ПРОБОЙ 5");
     
     spred=MarketInfo(NULL,MODE_SPREAD);
     
     IndicatorDigits(Digits);
     if (Digits <= 3) double K = 0.01; else K = 0.0001; 
     
    // double Pink_Level=Pink_Level * K;
    
    return(0); 
   } 
//+===========================================================================+ 
int start(){

    int i,Counted_bars;     
    Counted_bars =Bars- IndicatorCounted();
             
    for (i = Counted_bars-1; i>=0;i++){
    
            Order_Buy[i] = 0; 
            Order_Sel[i] = 0;
            Deal_Buy[i]  = 0; 
            Deal_Sel[i]  = 0;
            Stop_Buy[i]  = 0;
            Stop_Sel[i]  = 0;
            Profit_Buy[i]= 0;
            Profit_Sel[i]= 0;   
//----------------получаем пробой 5 фракталов              
       double proboy_5_UP = iCustom (NULL,0,"ME_Proboy_F5_For_EX",T_Life_CDL ,Img_UP_DW, Lime, Img_DW_UP, DeepPink,0,i);  
       double proboy_5_DW = iCustom (NULL,0,"ME_Proboy_F5_For_EX",T_Life_CDL ,Img_UP_DW, Lime, Img_DW_UP, DeepPink,1,i);
//----------------если пробой есть,то выставляем ордер       
       int n;
       
        if (proboy_5_UP==1){
         
          double Buy= iCustom(NULL,0,"ME_Order_ATR_For_EX",period_Teni,period_ATR,min_order,koef_R,text,0,i);
          int    num_Buy=i;
          double Buy_Stop=iCustom(NULL,0,"ME_Order_ATR_For_EX",period_Teni,period_ATR,min_order,koef_R,text,2,i);
          double Buy_Profit=iCustom(NULL,0,"ME_Order_ATR_For_EX",period_Teni,period_ATR,min_order,koef_R,text,4,i);
          
          O_Buy=1; 
       
//---------------проверяем время жизни        
         if (O_Buy==1 && Buy<=High[i]+spred && num_Buy >=i-T_Life_ORD+1 ){
            Buy=0;
            Buy_Stop=0;  
            Buy_Profit=0; 
         }
         if (O_Buy==1 && Buy<=High[i]+spred) D_Buy=3;
         if (D_Buy==3 && Buy_Stop>=Low[i]) S_Buy=2;
         if (D_Buy==3 && S_Buy!=2 && Buy_Profit<=High[i]) P_Buy=2;
       }
      
//----------------если пробой есть,то выставляем ордер           
       if (proboy_5_DW==-1){
          double Sel= iCustom(NULL,0,"ME_Order_ATR_For_EX",period_Teni,period_ATR,min_order,koef_R,text,1,i);
          int    num_Sel=i;
          double Sel_Stop=iCustom(NULL,0,"ME_Order_ATR_For_EX",period_Teni,period_ATR,min_order,koef_R,text,3,i);
          double Sel_Profit=iCustom(NULL,0,"ME_Order_ATR_For_EX",period_Teni,period_ATR,min_order,koef_R,text,5,i);
          O_Sel=-1; 
        
       
//---------------проверяем время жизни           
          if (Sel==-1 && Sel<=High[i]+spred && num_Sel >=i-T_Life_ORD+1 ){
            Sel=0;
            Sel_Stop=0;  
            Sel_Profit=0; 
          }
          if (Sel==-1 && Sel<=High[i]+spred) D_Sel=-3;
          if (D_Sel==-3 && Sel_Stop<=High[i]) S_Sel=-2;
          if (Sel==-1 && S_Sel!=-2 &&Sel_Profit>=Low[i]) P_Sel=-2;
      
      
   
   
   
  
//=========================================== Вывод результатов ============================================
            Order_Buy[i] = O_Buy; 
            Order_Sel[i] = O_Sel;
            Deal_Buy[i]  = D_Buy; 
            Deal_Sel[i]  = D_Sel;
            Stop_Buy[i]  = S_Buy;
            Stop_Sel[i]  = S_Sel;
            Profit_Buy[i]= P_Buy;
            Profit_Sel[i]= P_Sel; 
            
         }
         
       }
       return(0);       
}
           
          

I am FORGIVEN THANK YOU FOR PARTICIPATION and YOU HELP, respectfully, Olga.

Reason: