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

 
Alexandr Sokolov:

Here's my code.


Checked it, everything works, either you're changing the wrong code or compiling or ... Well, reset the terminal or something, but it's definitely working.

 
Igor Makanu:

Checked, everything works, either you're changing the wrong code or compiling or ... Well, reboot the terminal or something, but it's definitely working.

I have checked everything more than once. If you want to be sure - I can show you via TeamViever

 
Alexandr Sokolov:

I have already checked everything more than once. If you want to make sure - I can show you everything through TeamViever

You'd better (additionally) attach the code as a file to the message - as in the text, the code is not designed (no header) and it is not clear which terminal the code is for.

 
Alexandr Sokolov:

Here's my code


You have an extern uint. What do you want? Well, read the answers carefully.
 
Vladimir Karputov:

You'd better (additionally) attach the code as a file to the message - as in the text, the code is not formatted (no header) and it is not clear which terminal the code is for.

Files:
test.mq5  1 kb
 
Alexandr Sokolov:

extern in mt5 does not display, only input. And

 
Vitaly Muzichenko:

extern in mt5 does not display, only input


Now I see, I was looking for an error

 
Alexandr Sokolov:

Here is a correctly created indicator - there is a header, no "strict" - they are not needed in MQL5, no "extern" - it's the last century, while the indicator doesn't display anything, we indicate at once the number of buffers "0" and the number of constructions "0":

#property indicator_buffers 0
#property indicator_plots   0

Here's the whole code:

//+------------------------------------------------------------------+
//|                                                         Test.mq5 |
//|                              Copyright © 2019, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2019, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.000"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0
//--- input parameters
input uint x=10; // X
input uint y=20; // Y
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- 
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

Further on, we can dance from this code.



Files:
Test.mq5  4 kb
 
Vladimir Karputov:

Here is a correctly created indicator - there is a header, no "strict" - they are not needed in MQL5, no "extern" - it's the last century, while the indicator doesn't display anything, we specify the number of buffers "0" and the number of constructions "0":

Here's the whole code:

You can dance further on this dummy.

This is not the last century - this is a really cool thing.

The input cannot be changed, you have to re-assign it, which is wild. There are no such problems withextern, the only problem is that for some reason it does not work in mt5

 
Vitaly Muzichenko:

It's not last century - it's really cool.

input cannot be changed - you have to reassign it, which is wild. There are no such problems withextern, the only problem is that for some reason it does not work in mt5

The help will tell you what it is for. And yes, it is correct that the parameter entered by the user cannot be changed programmatically. At least something can belong to the user :)
Reason: