Questions from Beginners MQL5 MT5 MetaTrader 5 - page 764

 
Vladimir Karputov:

Just wrote this yesterday:

Task:

on each tick get "InpCountCopy" elements open, high, low, close and time.

Implementation:

  1. loop from "0" to "InpCountCopy-1" - the loop gets one open, high, low, close and time at a time.
  2. At one time we get "InpCountCopy" elements into MqlRates structure and then loop through the structure.

Features:

You can choose how to check: in OnTick or in OnTimer (1 second).


What do I need it for? The question was not for everyone, but only for Aleksey Vyazmikin
 
Alexey Viktorov:
Why me? The question was not for everyone, but only for Aleksey Vyazmikin

Edited: now for everyone :)

 

Can you tell me, I've done everything according to fancy style, I drew a line in init, selected it, but in the tester in visual mode I cannot move it from its place, in general it is impossible to do anything with it.

What's wrong, what do I have to do to manipulate it? There is no problem in quadruplet


 
Vitaly Muzichenko:

Can you tell me, I've done everything according to fancy style, I drew a line in init, selected it, but in the tester in visual mode I cannot move it from its place, in general it is impossible to do anything with it.

What's wrong, what do I have to do to manipulate it? There is no problem in quadruplet

In the tester, as far as I know, you can't manually control the graphics.
 
Alexey Kozitsyn:
In the tester, as far as I know, you can not control the graphics manually.

The answer is probably wrong, it can't be, it's a strategy tester. More likely a bug on my part, but how to fix it?

 
Vitaly Muzichenko:

The answer is probably wrong, it can't be, it's a strategy tester. More likely a fault on my part, but how do I fix it?

I don't think so... The MT5 strategy tester does not allow manual interaction with objects, because the MT5 tester is a separate program.
 
Alexey Kozitsyn:
Unlikely... The MT5 strategy tester does not allow manual interaction with objects, as the MT5 tester is a separate program.
Doesn't OnChartEvent() work in the mt5 tester?
 
Artyom Trishkin:
Doesn't OnChartEvent() work in the mt5 tester ?
Let's check it now :)
 
Alexey Kozitsyn:
Let's check it out now:)
I think it worked. It's been a while, though. Now I can't check on my mobile phone. Waiting.
 
Artyom Trishkin:
Seems to have worked. A long time ago though. But now I can't check on my mobile phone. Waiting.

A mouse movement event is definitely not generated. It's the same with the others, I think.

#property version   "1.00"
#property indicator_chart_window
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
//---
   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);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
  {
   if(id==CHARTEVENT_MOUSE_MOVE)
     {
      Print(__FUNCTION__,": ДВИЖЕНИЕ!");
     }
  }
//+------------------------------------------------------------------+
Reason: