Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1548

 
klycko (Symbol()))) // sets symbol name

return(INIT_FAILED);

// double TTVV = double TickValue() const

How to get TickValue?

double TTVV = m_symbol.TickValue();
 
Aleksandr Slavskii #:
double TTVV = m_symbol.TickValue();

Thanks a lot!

 

Do I understand correctly that EAs do not have access to the Windows clipboard (without using dll)?

If there is, then how can I set a value to the Expert Advisor variable from the clipboard?

 
HarDoX #:

Do I understand correctly that EAs don't have access to the Windows clipboard (without using a dll)?

If there is, then how can I set a value to the Expert Advisor variable from the clipboard?

Of course, there is no such access.

 
HarDoX #:

Do I understand correctly that EAs don't have access to the Windows clipboard (without using a dll)?

If there is, then how can I set a value to the Expert Advisor variable from the clipboard?

There are ready-made variants using dll.

 

Good afternoon, colleagues!

I have started to study arrays, but I can't get a handle on them yet.

The idea is as follows:

1. We have MA200

2. I want to enter the maximum deviations from MA200 into the array. We roll back from the 1st candle 200 bars, and record all 200 deviations that are above MA200.

3. We select the 50 largest of them.

Well, that's enough for now, I think I will finish the rest.


I wrote the function code, but the log is empty (there were prints there), nothing works)


//+------------------------------------------------------------------+
//|      Калькуляция отклонений                                      |
//+------------------------------------------------------------------+
void PricePeaks()
  {
   
   
   //1. Создать массив для МА
   int totalBars = 200;
   double MAValue[];
   ArraySetAsSeries(MAValue,true);
   double bufferMA = CopyBuffer(SlowHandle,0,1,totalBars,MAValue);
   
   //2. Создать массив для цен High
   
   int nemberBars = 200;
   double highPrices[];
   
   int cpoied = CopyHigh(_Symbol,PERIOD_D1,1,totalBars,highPrices);
   //3. Создать массив для хранения отклонений
   
  // 4. Запустить цикл, в котором я переберу последние 500 баров, и когда хай будет > МА, я буду записывать такой Хай в массив Dev
   
  // 5. После цикла У меня будет массив, заполненный значениями. Делаю сортировку ArraySort (от меньшего к большему)
   
  // 6. Нахожу 50 самых последних записей и сохраняю их в файл, например. 
   
   


 }
 
Sergey Izhutov #:


I wrote the function code, but the log is empty (there were prints there), nothing works)

In the Experts tab, is anything displayed?

Regards, Vladimir.

 
MrBrooklin #:

In the Experts tab, does it show anything?

Regards, Vladimir.

Now yes, the log is filled in. I have made a print for now:

 Print("bufferMA ",bufferMA);
   Print("copied = ",copied);

Prints the value 500 to both buffers

 
Sergey Izhutov #:

Now yes, the log is filling up. I've made a print so far:

Prints the value 500 to both buffers

You have MA values in the MAValue array. The bufferMA variable should be of int type, and the number of copied values is returned to it. I don't understand why you have 500 instead of 200.
 
Yuriy Bykov #:
The MA values are stored in the MAValue array. The bufferMA variable should be of int type, and the number of copied values is returned to it. I don't understand why you have 500 and not 200.

I changed totalBars to 500 as I went along. Thank you very much for your help!


Now I want to

//3. Создать массив для хранения отклонений

I don't understand the best way to do this. I have two arrays with prices now (MA and Hai values).So I need to loop over the "totalBars" bars? And when the high was greater than the MA200 and write that deviation into the array?