Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 114

 
Sergey Gritsay:
R What objects are not different? and what does it mean to change the type of object, the properties will collapse?

This means that if I replace the horizontal line object with a trend line or a vertical line on the current candlestick in my current code, one object will still work and it will be red regardless of the parameters of the other object.

The purpose of all these manipulations is to combine the indicator and the EA, now I'm trying to find the error itself.

i.e. it creates moves and deletes quite normally, but i need blue when i buy, not red when i sell in any way.
 

Greetings. Can you tell me what the () bracket entry after "double bb" is and what the {} bracket entry for"double bb(int buff,int shift)" is in this case?

double bb(int buff,int shift){ double val = iCustom(_Symbol,0,"BvsB",BB_Period,buff,shift);return(val);}  


Also here. Buy and Sell have the bool type. How can I figure out what is assigned to them when using "< , &&, >"? ?

void Entry()
{  
  if(!UseHTF){
  Buy  = (bb(0,1) < bb(1,1) && bb(0,2) > bb(1,2));
  Sell = (bb(0,1) > bb(1,1) && bb(0,2) < bb(1,2));}
  
  if(UseHTF){
  Buy  = (bbh(0,1) < bbh(1,1) && bb(0,1) < bb(1,1) && bb(0,2) > bb(1,2));
  Sell = (bbh(0,1) > bbh(1,1) && bb(0,1) > bb(1,1) && bb(0,2) < bb(1,2));}  
  
 
Andrey Sokolov:

Greetings. Can you tell me what the () bracket entry after "double bb" is and what the {} bracket entry for"double bb(int buff,int shift)" is in this case?

double bb(int buff,int shift){ double val = iCustom(_Symbol,0,"BvsB",BB_Period,buff,shift);return(val);}  


Also here. Buy and Sell have the bool type. How can I figure out what is assigned to them when using "< , &&, >"? ?

void Entry()
{  
  if(!UseHTF){
  Buy  = (bb(0,1) < bb(1,1) && bb(0,2) > bb(1,2));
  Sell = (bb(0,1) > bb(1,1) && bb(0,2) < bb(1,2));}
  
  if(UseHTF){
  Buy  = (bbh(0,1) < bbh(1,1) && bb(0,1) < bb(1,1) && bb(0,2) > bb(1,2));
  Sell = (bbh(0,1) > bbh(1,1) && bb(0,1) > bb(1,1) && bb(0,2) < bb(1,2));}  
  


1. it is a function. In parentheses - parameters, which are passed to the function when it is called. In this case - number of indicator buffer and offset of bar, from which we get indicator values.

2) Boolean variables are assigned with the result of the whole logical expression, following the assignment sign (=). If all conditions are true, the variable is assigned true, otherwise - false
 
Artyom Trishkin thank you
 
trader781:

This means that if I replace the horizontal line object with a trend line or a vertical line on the current candlestick in my current code, one object will still work and it will be red regardless of the parameters of the other object.

The purpose of all these manipulations is to combine the indicator and the EA, now I'm trying to find the error itself due to what is causing it.

i.e. it moves and deletes quite normally, but i need blue when i buy, not red when i sell in any way.
it means you set the parameters of the graphical object incorrectly again
 
Sergey Gritsay:
So you're setting the parameters of the graphical object wrong again.

most likely.

It seems to be textbook, but the result is not the same, that's why I threw the code here.

 
Hello!
I can't understand why there is a Client Terminal Global Variable in the terminal if I didn't create it ?(GlobalVariablesTotal() shows "1"). Maybe there is some preset by the terminal ? Then why when I want to know its name and call GlobalVariableName(0) or GlobalVariableName(1) function, no names are shown. Please tell me what could be the problem ?
 

Greetings. I need to get the data on the red line of the indicator which is not overlaid on the price chart but is displayed separately under it. I am trying to do it as with the indicators that are superimposed on the chart, but something is wrong. Where am I wrong?

Signal=iCustom(NULL, 0,"ytg_Def_RSI_3_Symbol", RSI_1_Period, RSI_2_Period, applied_price, ma_period, ma_method, 1,shift);

Here is the indicator itself

#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"

//ну если проще запулить в одно окно три мульти с настройками
//1 EUR-USD
//2 EURGBP
//3 EURJPY
//если все три в состоянии перекупленности  значит Бай и наоборот

#property indicator_separate_window
#property  indicator_buffers 6
#property   indicator_color1  Green
#property   indicator_color2  Red
#property   indicator_color3  Yellow
#property indicator_level1 0
#property indicator_level2 5
#property indicator_level3 -5

extern string Symbol_1   = "EURUSD";
extern string Symbol_2   = "EURGBP";
extern string Symbol_3   = "EURJPY";

extern int RSI_1_Period  = 14;//период первого индикатора РСИ
extern int RSI_2_Period  = 28;//период второго индикатора РСИ
extern int applied_price = 0;//используемая цена  0-6
extern int ma_period     = 14;//период сглаживания
extern int ma_method     = 0;//метод сглаживания  0-3

double       buf[];
double    MA_buf[];
double      buf2[];
double   MA_buf2[];
double      buf3[];
double   MA_buf3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(0, buf);
  
   SetIndexStyle(4,DRAW_NONE);
   SetIndexBuffer(4,MA_buf);
  
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(1, buf2);
  
   SetIndexStyle(3,DRAW_NONE);
   SetIndexBuffer(3,MA_buf2);  
    
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(2, buf3);
  
   SetIndexStyle(5,DRAW_NONE);
   SetIndexBuffer(5,MA_buf3);
  
   IndicatorShortName("ytg_Def_RSI_3_Symbol");
   Comment("yuriytokman@gmail.com");  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   Comment("");  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
   double RSI_1, RSI_2, RSI_12, RSI_22, RSI_13, RSI_23;
  
   int limit;
   int counted_bars=IndicatorCounted();
  
   if(counted_bars<0) return(-1);

   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(int i=limit; i>=0; i--)
   {
     RSI_1 = iRSI(Symbol_1,0,RSI_1_Period,applied_price,i);
     RSI_2 = iRSI(Symbol_1,0,RSI_2_Period,applied_price,i);

     MA_buf[i] = (RSI_1-RSI_2);
    
    
     RSI_12 = iRSI(Symbol_2,0,RSI_1_Period,applied_price,i);
     RSI_22 = iRSI(Symbol_2,0,RSI_2_Period,applied_price,i);

     MA_buf2[i] = (RSI_12-RSI_22);
    
    
     RSI_13 = iRSI(Symbol_3,0,RSI_1_Period,applied_price,i);
     RSI_23 = iRSI(Symbol_3,0,RSI_2_Period,applied_price,i);

     MA_buf3[i] = (RSI_13-RSI_23);          
   }
   for(i=limit; i>=0; i--)
   {
     buf[i] = iMAOnArray(MA_buf,0,ma_period,0,ma_method,i);
    
     buf2[i] = iMAOnArray(MA_buf2,0,ma_period,0,ma_method,i);    
    
     buf3[i] = iMAOnArray(MA_buf3,0,ma_period,0,ma_method,i);    
   }  
  
  
//----
   return(0);
  }
 
Andrey Sokolov:

Greetings. I need to get the data on the red line of the indicator which is not overlaid on the price chart but is displayed separately under it. I am trying to do it as with the indicators that are superimposed on the chart, but something is wrong. Where am I wrong?

Signal=iCustom(NULL, 0,"ytg_Def_RSI_3_Symbol", RSI_1_Period, RSI_2_Period, applied_price, ma_period, ma_method, 1,shift);

Here is the indicator itself

extern string Symbol_1   = "EURUSD";
extern string Symbol_2   = "EURGBP";
extern string Symbol_3   = "EURJPY";

extern int RSI_1_Period  = 14;//период первого индикатора РСИ
extern int RSI_2_Period  = 28;//период второго индикатора РСИ
extern int applied_price = 0;//используемая цена  0-6
extern int ma_period     = 14;//период сглаживания
extern int ma_method     = 0;//метод сглаживания  0-3

You open the window of input parameters and list them iniCustom in order.

You are missing the first three line values:

 
Vitaly Muzichenk, thank you.