Questions from Beginners MQL5 MT5 MetaTrader 5 - page 38

 
Here's an example of how I use the indicator, they're all the same.
double  iMAf( string symbol, ENUM_TIMEFRAMES timeframe, int period, int ma_shift, ENUM_MA_METHOD ma_method, int applied_price, int shift){
 
 
 
                   int handle=iMA(symbol,timeframe,periodd(period),ma_shift, ma_method,applied_price);Sleep(2000);
                    CopyBuffer(handle,0,0,100,MA);
                    ArraySetAsSeries(MA,true);
    return( (MA[shift])); } 
                   

Prescribed outside all functions

 double MA[]; 
//---- handles for indicators
int MA_handle;

Did I write something wrong in general, or where to look in general, what is wrong with it?

 

Handles are created in OnInit()

void OnInit()
  {
   ma_h=iMA(_Symbol,_Period,MA_Period,0,MODE_SMA,PRICE_CLOSE);
  }

We get data in OnTick ()

void OnTick()
  {
   CopyBuffer(ma_h,0,1,2,ma);
  }

This is an example of a standard construct.

 
Now, I'll use notepad to find these indicators specifically
 
Thank you!!!!
 
It only triggers once, on start-up, and then?
 
You create the indicators once, and then you get the values from them as you work.
 
I'm sorry, what would make the handle redraw with the arrival of new ticks or at least bars, if it's created in it's init? Really, just want to understand.
 
Dimka-novitsek:
I'm sorry, what would make the handle redraw with the arrival of new ticks or at least bars, if it's created in it's init? Really, just want to understand.
Handle is id, reference to indicator. once received and then CopyBuffer( handle,....)
 
Dimka-novitsek:
Four thousand three hundred and two is not a string, and what's wrong with it anyway?

When the compiler issues an error, it indicates the line number and the cursor position number.

When the terminal issues an error, it indicates the error number. See the Runtime Errors section in the Handbook, and which error corresponds to the value "4302". Handle creation location is a side-issue :)

 
THANK YOU!!!
Reason: