Question for connoisseurs - page 15

 
rid >> :

Here's how it's done:

So you have StopLoss == TakeProfit and there is no such option in the comparison conditions ((

 
I think you have to count from Ask. Sell at Bid, close at Ask.
 

Yes, - it may very well be that Ask needs to be shut down. I will try that.

I.e. for sell takeprofit can also be from Bid.

And stop loss - should be strictly from Ask, probably... stop leveller should be counted

 

Good afternoon, everyone.

Here is a question.

For some reason the Expert Advisor (Pips, Grider) on the real account has got the habit to suddenly stop working for no apparent reason! (DC Broko).

Sometimes it happens after server downtime (it often happens there), and after the resumption of quotes the Expert Advisor (or MT4) has to be restarted and only then it starts to work.

Sometimes the EA stops, again, for no apparent reason and you need to restart mt4 or reinstall the EA to "push" it.

Orders are placed correctly. I do not want to have to ask a question on the forum.

There are no errors in the LogFile. Who has had problems with this, please advise ?

I do not want to pose a question to the Technical Support on the forum not to draw attention to my account.

 
How to simplify the pattern from the article "Relying on the power of patterns" by removing SL, TP, pending orders and their modification. Otherwise it is impossible to experiment.
 
shap писал(а) >>
How to simplify the template from the article "Relying on the power of templates" by removing SL, TP, pending orders and their modification. Otherwise it's impossible to experiment.

This is the fourth post with the same content. >> Not good.

 

Good evening. Question about the indicator.

I am setting the Gann fan from low to high and from low to low in the indicator.

But for some reason the lines of the fan are not directed the way I want them to - they are drawn randomly!

For example, like this (here the fan moved upward from the maximum 1.4071 for some reason):

I do not know why it is like that.

I set the bars in the STRAT function like this:

//задаем текущие значения ввера Ганна от минимума вверх
// и вычисляем масштаб веера
        ObjectMove( "GANNFAN_" ,0,Time[ xLOW], LOW);
        Масштаб_Веера_= MathAbs (MathSqrt(( LOW)*10000) ) ;

//задаем текущие значения ввера Ганна от максимума вниз
// и вычисляем масштаб веера
        ObjectMove( "GANNFAN" ,0,Time[ xHIGH], HIGH);
        Масштаб_Веера= (-1)* MathAbs(MathSqrt(( HIGH)*10000)  );

Please tell me why and where is the mistake?

 

Here is all the code for the indicator;

#property indicator_chart_window
//-------------------------------------------------------------------+
extern string     _  = "---- ОБЩИЕ ПАРАМЕТРЫ -----" ; 
extern int       Bars_=200;//кол-во баров для расчета формулы
extern int       TimeFr=0;//задаем тф для расчета
extern color     Цвет_Веера = DarkViolet;     
//--------------------------------------------------------------
int     xLOW, xHIGH;
double   HIGH, LOW ;
 double       Масштаб_Веера ;
 double       Масштаб_Веера_ ;
//+------------------------------------------------------------------+
int init()
  { 
//обьявляем веер Ганна от мин вверх  
ObjectCreate("GANNFAN_",OBJ_GANNFAN,0,0,0,0,0); 
//задаем флаг фонового отображения веера 
 ObjectSet("GANNFAN_", OBJPROP_BACK,1);
 //задаем цвет веера 
ObjectSet("GANNFAN_", OBJPROP_COLOR, Цвет_Веера);
//задаем толщину линий веера Ганна
ObjectSet("GANNFAN_", OBJPROP_WIDTH,2); 
 //задаем масштаб веера Ганна   
ObjectSet("GANNFAN_", OBJPROP_SCALE, Масштаб_Веера_); 

//обьявляем веер Ганна  от макс вниз 
ObjectCreate("GANNFAN",OBJ_GANNFAN,0,0,0,0,0); 
//задаем флаг фонового отображения веера 
 ObjectSet("GANNFAN", OBJPROP_BACK,1);
 //задаем цвет веера 
ObjectSet("GANNFAN", OBJPROP_COLOR, Цвет_Веера);
//задаем толщину линий веера Ганна
ObjectSet("GANNFAN", OBJPROP_WIDTH,2); 
 //задаем масштаб веера Ганна   
ObjectSet("GANNFAN", OBJPROP_SCALE, Масштаб_Веера);  
 
//задаем вертикальные линии от экстремумов 
ObjectCreate("line",OBJ_VLINE,0,0,0,0,0);//вертикальная линия от макс
ObjectSet("line", OBJPROP_BACK,1);
ObjectSet("line", OBJPROP_COLOR,Red);//цвет
ObjectSet("line", OBJPROP_WIDTH,2); //толщина линии
ObjectCreate("line_",OBJ_VLINE,0,0,0,0,0);//вертикальная линия от мин
ObjectSet("line_", OBJPROP_BACK,1);
ObjectSet("line_", OBJPROP_COLOR,Orange);//цвет
ObjectSet("line_", OBJPROP_WIDTH,2);//толщина линии 
  }//------конец функции ИНИТ

//+------------------------------------------------------------------+
int deinit() {
ObjectDelete("GANNFAN_");
ObjectDelete("GANNFAN");
ObjectDelete("line");
ObjectDelete("line_");
//if (!IsTesting()) ObjectsDeleteAll(0,OBJ_TREND);  
               }

//+------------------------------------------------------------------+

int start()
  { 
 xHIGH =  iHighest( NULL, TimeFr, MODE_HIGH, Bars_ ,1); //номер бара максимума
 HIGH =  iHigh ( NULL, TimeFr, xHIGH) ;        // ценовое значение максимума
 xLOW  =  iLowest( NULL, TimeFr, MODE_LOW, Bars_ ,1);   //номер бара минимума
 LOW  =  iLow( NULL, TimeFr, xLOW) ;            // ценовое значение минимума
//задаем текущие горизонтальные лимнии на мин и макс
//ObjectMove( "lowline" ,0,Time[ xLOW] , LOW); 
//ObjectMove("highline",0,Time[ xHIGH], HIGH); 
        
 //задаем текущие значения ввера Ганна от
// минимума и вычисляем масштаб веера
   ObjectMove( "GANNFAN_" ,0,Time[ xLOW], LOW);
   Масштаб_Веера_= MathAbs (MathSqrt(( LOW)*10000) ) ;
        
//задаем значения для отрисовки вертик линии на минимуме
   ObjectMove( "line_" ,0,Time[ xLOW],0); 
        
          
//задаем текущие значения ввера Ганна от 
//максимума вниз и вычисляем масштаб веера
   ObjectMove( "GANNFAN" ,0,Time[ xHIGH], HIGH);
   Масштаб_Веера= (-1)* MathAbs(MathSqrt(( HIGH)*10000)  );
        
 //задаем значения для отрисовки вертик линии на максимуме
 ObjectMove( "line" ,0,Time[ xHIGH],0); 


   return(0);
  }//конец функции СТАРТ
 

Hi, this is only my second post, that is, a newcomer to the forum, started to learn the language, of course, questions abound, and it's kind of hard to learn from books. I started with a textbook, a respected forum member Sergei Kovalev, and some of the articles of this forum studied ... After much theory, began practice, created a template and outline of the first expert, divided it into blocks, and now one function after another parse (thoroughly) to understand how it works, believe me if you diver rather than a programmer, it's not easy to break everything in my head, and to comprehend what to what. So here's the thing, can anyone suggest that for me Professionals so far, the real problem: Today I sat all day and was able to solve the problem.

I'm running some functions as a script to check if they compile and which ones don't work or not in the terminal. Took today the Pre-calculation function of bars in the window:

//+------------------------------------------------------------------+

int start()
  {
      int A = 100;
//+------------------------------------------------------------------+  
      if(Bars < A)             // Недостаточно баров
      {      
      Alert("Недостаточно баров в окне инструмента.");
      return;                  // Выход из start()
      }


  return(0);
  }
//+------------------------------------------------------------------+  

Naturally the message *Not enough bars* comes out, but on a new tick I understand this message will appear again indefinitely.

Now I add a variable and add an if statement, and in a future error block Bloc_Error, I put a switch statement and get this:

int start()
  {
      int A = 100;
      bool Work=true;   
//+------------------------------------------------------------------+      
      int Bloc_Error    // Пользовательская функция
//+------------------------------------------------------------------+      
    switch()           // Преодолимые ошибки:
      {
      case 3:          // Неверные параметры:
      Work=false;
      return(0);
      }

//+------------------------------------------------------------------+ 

      if(Bars < A)   // Недостаточно баров
      {      
      Alert("Недостаточно баров в окне инструмента.");
      return;                  // Выход из start()
      }
      if( Work==false)          // Ошибка   
      {      
      Alert("Эксперт не работает.");     
      return;                  // Выход из start   
      }
//+------------------------------------------------------------------+   
  return(0);
   }
The question is what have I done wrong here in the switch statement, why isn't the *Expert not working* message popping up, and for the EA to actually stop working?????
 

"divide and conquer"... - don't mix unexamined points... the point of error should be easier to identify...

https://docs.mql4.com/ru/basis/operators/switch - everything can be seen at once. until the design is fixed in your head - use the classic pattern. compare it carefully - you will find the errors immediately.

Learn to use the search engine.

After reading the documentation "on the subject", find the texts with codes and see HOW they are applied...