Questions from Beginners MQL5 MT5 MetaTrader 5 - page 174

 
barabashkakvn:

The MQL5 indicator now calculates correctly and economically.

Hurrah!!! It worked! Thank you! How can I change "price[i]" variable to maximum? If I understand it correctly, it requests the current price.

I need something similar to "iHigh" from MQL4 to see the extreme outliers over the line.

 
1218152019:
Please advise how to bind trading signals robot to a real trading account on the platformuTrader TP, the problem is that when you sign up in the login window pops up a comment that the username of the trading account can only be digital. and I login is the name of my mailbox. how in this case, bind the robot to your real trading account?

I don't.

Как подписаться на Торговые Сигналы
Как подписаться на Торговые Сигналы
  • 2012.10.09
  • MetaQuotes Software Corp.
  • www.mql5.com
Новая версия сервиса «Сигналы» на MQL5.com теперь интегрирована с торговой платформой MetaTrader 5 и позволяет трейдерам подключаться к любому сигналу, выставленному продавцом. Это означает, что вы выбираете заинтересовавшего вас поставщика торговых сигналов, подписываетесь на него – и все его сделки с этого момента повторяются на вашем счете.
 
forexman77:

Hooray!!! It worked! Thank you! How can I replace the variable "price[i]" with the maximum? If I understand it correctly, it requests the current price.

I need something similar to "iHigh" from MQL4 to see the extreme outliers over the line.

When you attach the indicator to the chart, click on the tabs - there you will find a drop-down list of different price variants at which the indicator will be calculated (Open, Close....)
 
barabashkakvn:
When attaching the indicator to the chart, click on tabs - there you will find a drop-down list with different price variants on which the indicator will be calculated (Open, Close....)

In the calculate function put in place of the previous one:

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[])
  {
and replaced price[i] by high[i]. It seems to work. It works.
 
forexman77:

In the function calculate put in place of the old one:

and replaced price[i] with high[i]. It seems to work. It works!
In this case you will be hardwired to High in the indicator code. But it is correct too. Good luck!
 
barabashkakvn:
In that case you will be hardwired to High in the indicator code. It's the right thing to do though. Good luck!
Thank you again! MQL5 is a much more complicated language than MQL4.
 

Need to get the time or index of a bar obtained using the ArrayMaximum function.

I managed to get the maximum, the total number of bars. And then it's not clear.

double High[];
int i=0;
int k=12;
CopyHigh(_Symbol,_Period,i,k,High);
double Maxi=High[ArrayMaximum(High)]//получено значение максимума 
Alert("Maxi=",Maxi);
int e=ArraySize(High);//получено общее кол-во баров  
Alert("e=",e);
Документация по MQL5: Операции с массивами / ArrayMaximum
Документация по MQL5: Операции с массивами / ArrayMaximum
  • www.mql5.com
Операции с массивами / ArrayMaximum - Документация по MQL5
 
forexman77:

Need to get the time or index of a bar obtained using the ArrayMaximum function.

I managed to get the maximum, the total number of bars. But further on, it is not clear.

Read theArrayMaximum help at https://www.mql5.com/ru/docs/array/arraymaximum.

You have already got the index of the bar.

Документация по MQL5: Операции с массивами / ArrayMaximum
Документация по MQL5: Операции с массивами / ArrayMaximum
  • www.mql5.com
Операции с массивами / ArrayMaximum - Документация по MQL5
 
barabashkakvn:

Read the help aboutArrayMaximum https://www.mql5.com/ru/docs/array/arraymaximum

You already got the bar index.

Thank you! The index has been extracted. Now I can't get its correct time. I use the function CopyTime for this.

Maybe there are some other ways to get the time of got index element?

double High[];
datetime Time[];
int i=0;
int k=31;
CopyHigh(_Symbol,_Period,i,k,High);
double Maxi=High[ArrayMaximum(High)];
int s=ArrayMaximum(High,i,k);
int start = s;// индекс бара
int count = 1; // количество баров
CopyTime(_Symbol,_Period,s,count,Time);
Alert("Time=",Time[0]);
Alert("s=",s);
Alert("Maxi=",Maxi);
 
forexman77:

Thank you! The index has been extracted. Now I can't get his correct time.


Alert("Time=",Time[s]);
Reason: