Errors, bugs, questions - page 2148

 
Andrey Khatimlianskii:

Is it confirmed?

No, of course not. Everything written here is an independent conclusion.

I remember either Renat or Slava saying that indicators are not duplicated, even if manually run. The hash of parameters matches - the same calculation part is used.

This is not true. And most importantly, it couldn't even be true.

Run this indicator manually on two identical charts

int OnCalculate( const int, const int, const int, const double &[] )
{
  Print(ChartID());
  
  return(0);
}

If the calculation parts were the same, there would be no different reruns. I think 90% of the conclusions voiced are correct.

 
Nexxtor:

Help authors, or MQL5 language, depending on who's hands are out of ***, you are so annoying!!!

IndicatorCreate() says:

parameters_cnt

[in] Number of parameters passed in the parameters_array[] array. Elements of the array have a special type of structureMqlParam. The default value is zero - no parameters are passed. If non-zero number of parameters is specified, theparameters_array parameter is mandatory. You can pass up to 256 parameters.


Tell me, have you personally checked it? That the indicator with 256 parameters will be called???


Fix it!!!

Doesn't it run? Show me the code that doesn't run.

And please, less emotion and more business.

 
fxsaber:

It is not true. And more importantly, it couldn't even be true.

Run this indicator manually on two identical charts

If the calculated parts were the same, there would be no different printout.

A very difficult conclusion for me.

Why should indicators see the same chart? Because an indicator algorithm can be built based onChartID???

 
fxsaber:

EAs on OBJ_CHART certainly don't run (or rather, don't work). So by timer, it seems to be OK. Perhaps all events are not working there.

The Expert Advisors on OBJ_CHART start and work fine. They only handle OnChartEvent (custom) and can generate their custom events for other charts.

 
Andrey Khatimlianskii:

Why should indicators see the same chart?

iCustom indicators do not have their own chart. Even when added to some chart.

Because an indicator algorithm can be built based on ChartID???

Yes, Chart-functions and events applied to their chart (manual/template indicators) can be used for any action.

 

Error in the Documentation

ChartNavigate

Moves the specified chart by the specified number of bars relative to the specified chart position.

bool  ChartNavigate(
   long  chart_id,     // идентификатор графика
   int   position,     // позиция
   int   shift=0       // значение сдвига
   );

Parameters

chart_id

[in] Chart ID. 0 means the current chart.

position

[in] Chart position relative to which the chart will be shifted. The value can be one of the values of enumENUM_CHART_POSITION.

 
Andrey Barinov:

Expert Advisors on OBJ_CHART run and work fine. They only handle OnChartEvent (custom) and can generate their own custom events for other charts.

Checked. Expert\Test.mq5

class CUSTOM
{
public:  
  CUSTOM()
  {
    Print(__FUNCSIG__);
    
    Print(EventSetTimer(1) && EventChartCustom(0, 0, 0, 0, NULL) &&
          MarketBookAdd(_Symbol) && 
          ChartSetInteger(0, CHART_EVENT_MOUSE_WHEEL, true) &&
          ChartSetInteger(0, CHART_EVENT_MOUSE_MOVE, true) &&
          ChartSetInteger(0, CHART_EVENT_OBJECT_CREATE, true) &&
          ChartSetInteger(0, CHART_EVENT_OBJECT_DELETE, true) &&
          ChartNavigate(0, CHART_BEGIN, 100) &&
          ObjectCreate(0, __FILE__, OBJ_VLINE, 0, 0, 0) &&
          ObjectDelete(0, __FILE__));
    
  }
  ~CUSTOM() { Print(__FUNCSIG__); }
};

const CUSTOM InitDeinit;

void OnTick() { Print(__FUNCSIG__); }
void OnInit() { Print(__FUNCSIG__); }
void OnDeinit( const int ) { Print(__FUNCSIG__); }
void OnChartEvent( const int id, const long&, const double&, const string& ) { Print(__FUNCSIG__ + " " + (string)id) ; }
void OnTimer() { Print(__FUNCSIG__); }
void OnBookEvent( const string& ) { Print(__FUNCSIG__); }


Script

#include <fxsaber\Expert.mqh>  // https://www.mql5.com/ru/code/19003

void OnStart()
{
  if (ObjectCreate(0, __FILE__, OBJ_CHART, 0, 0, 0))
  {
    MqlParam Params[1];
    Params[0].string_value = "Experts\\Test.ex5";

    Print(EXPERT::Run(ObjectGetInteger(0, __FILE__, OBJPROP_CHART_ID), Params));
  }
}


Result

Test3 (EURUSD,M1)       true
Test (EURUSD,M1)        void CUSTOM::CUSTOM()
Test (EURUSD,M1)        true
Test (EURUSD,M1)        void OnInit()
Test (EURUSD,M1)        void OnChartEvent(const int,const long&,const double&,const string&) 9
Test (EURUSD,M1)        void OnChartEvent(const int,const long&,const double&,const string&) 1000
Test (EURUSD,M1)        void OnChartEvent(const int,const long&,const double&,const string&) 9
Test (EURUSD,M1)        void OnChartEvent(const int,const long&,const double&,const string&) 9
Test (EURUSD,M1)        void OnChartEvent(const int,const long&,const double&,const string&) 9
Test (EURUSD,M1)        void OnDeinit(const int)
Test (EURUSD,M1)        void CUSTOM::~CUSTOM()


Conclusion about Expert Advisors on OBJ_CHART

  • Will work OnInit, OnDeinit, global constructor/destructor, and OnChartEvent.
  • OnTimer, OnTick and OnBookEvent don't work.
  • Only CHARTEVENT_CHART_CHANGE and custom events are caught.
  • Through OnChartEvent+EventChartCustom EA can create "events" for OnTimer and OnTick, but not OnBookEvent.
 
In glucotrader 5 the #property tester_file does not work correctly when FILE_COMMON is specified, the file does not open on the agent
 
Anton Ohmat:
In glucotrader 5 #property tester_file does not work correctly when FILE_COMMON is specified, the file is not opened on the agent

Well, the file is not taken from Common folder (common for Terminal and local Agents), but from Sandbox.

 
fxsaber:

Well, not from Common folder (common for Terminal and local Agents), but from Sandbox.

I test it on my remote servers - it doesn't work. Run is done only if the local machine in the directory MT lie files, COMMON on the optimization does not go


tester_file

string

File name for the tester, specifying the extension, enclosed in double quotes (as a constant string). The specified file will be passed to the tester for work. Input files for testing, if needed, should always be specified

Reason: