Learning and writing together in MQL5 - page 40

 
The indicator enters the general independent process of recalculation of the indicators, which runs parallel to the experts.
 
Dimka-novitsek: ... But what will make the indicator handle redraw with new ticks or at least bars, if it is created in OnInit?

It is not the indicator handle that is redrawn, but the graphical constructions of the indicator itself. The handle is just an integer value.

Dimka-novitsek:
Somehow it's unrealistic to write in it's init!

Let me explain in simple terms. The indicator can be run in two ways: manually and programmatically. In both cases, the terminal creates and supports the same calculation processes. After the soft start, like in the manual one, you just start the indicator once, and then it will be calculated in accordance with the code. For a program start of the indicator, the iCustom() function and its analogous functions are used. Once iCustom() with the correct set of parameters is successfully started, the appropriate calculation processes will work the same way, as they do at manual start.

Several indicators may be launched programmatically at the same time. A handle is just an identifier that allows you to address a certain computational process. Using a handle, you can copy the calculated data of a certain indicator launched programmatically.

Accordingly, in order to start the indicator programmatically and get its handle, in general, it's enough to do this in OnInit(). You don't start the indicator manually with every tick to "redraw" it.

 
Thank you!!!!
 
Thank you! I basically got it. And so I've been sitting here thinking for two hours now. Well, I'm not happy with the hendle announcement in the init. This is a multicurrency robot where about twenty currency pairs are listed. In different places in the robot there are calls to the specified functions, different timeframes are set... The robot is not realistic to declare so many handles before calculations, i.e. it may be real, but it's nonsense... On 4 it worked and it rustled!!! I'm sitting here and I'm really struggling...
int OnInit()
  {
//---
  if(Digits() == 3 || Digits() == 5) slip=slip *10; 
  //рисовка места под дашборд   
   time1 = 0;
   initGraph();
   ArrayInitialize(avg_,1);
//---
 ATR_handle=iATR(symbol,periodd(timeframe),period);
   return(0);
  }
//+------------------------------------------------------------------+
 
Actually ERR_MARKET_NOT_SELECTED 4302 No symbol selected in MarketWatch - dealing with the issue further, like where the root of the problem is.

How is not selected? What is not selected? What is MarketWatch? What is the symbol? Currency pair? So, no, I have a currency pair in my code as a function input very well!
 
I'll even check it, and I think I know how. But I can't find MarketWatch on google or Yandex, except for one line that it's fixed in the new version.
 
Dimka-novitsek:
Actually, ERR_MARKET_NOT_SELECTED 4302 Symbol not selected in MarketWatch - dealing with the issue further, like where the root of the problem is.

How is not selected? What is not selected? What is MarketWatch? What is the symbol? Currency pair? So, no, I have a currency pair in my code as a function input very well!

Look at the SymbolSelect() function. MarketWatch is the Market Watch window. Before you ask a question, try to find the answer using the forum search in the top right corner.

P.S. You don't have to write a thank you in every post. :)

 

Yep.

Checked-inserted the print, like this.

 double iATRf (string symbol, int timeframe, int period, int shift  ){
  
  Print("symbol");Print(symbol); Print("timeframe");Print(timeframe); Print( "period");Print( period);Print("shift");Print(shift);  
  
    ATR_handle=iATR(symbol,periodd(timeframe),period);
   CopyBuffer(ATR_handle,0,0,100,ATR);
    ArraySetAsSeries(ATR,true); 
    return( ATR[shift]); }  

And you know, the check showed that the function takes in normal, sane parameters. There you go. And I'll go through the links to get a better understanding of the question ! Thank you!

 
Dimka-novitsek:
I'll even check it, and I think I know how. But MarketWatch was not found in Google and Yandex, except for one line that it was fixed in the new version.
Well, Dimon Vladimirovich, you're a funny guy :)
 

Thank you!!!

Does this mean that the platform does not support this pair? 2012.09.21 16:23:17 Failed to create an iMA indicator handle for CADJPY/PERIOD_D1, error code 4302

Документация по MQL5: Технические индикаторы / iMA
Документация по MQL5: Технические индикаторы / iMA
  • www.mql5.com
Технические индикаторы / iMA - Документация по MQL5