Questions from a "dummy" - page 138

 
joo:
If not a script, then all of the logic should be executed/called in/from OnChartEvent()?

You can do it anywhere. There's also a timer.

If you need cyclic logic, you can put it in a timer.

If the logic is event-driven, then in chartevent.

 
sergeev:

You can do it anywhere. There's also a timer.

If you want cyclic logic, you can put it in a timer.

If logic is event-driven, then in chartevent.

This is the logic:

1. Start of program (thrown on chartevent).

2. from the dialog box (file listing) get the file name.

3. We open the file by file name and receive and process data.

4. Exited the program.

That's all there is to it. How this case can be organised, please show at least schematically.

Документация по MQL5: Файловые операции / FileOpen
Документация по MQL5: Файловые операции / FileOpen
  • www.mql5.com
Файловые операции / FileOpen - Документация по MQL5
 
joo:

Such logic:

1. Start the programme (thrown on the chart).

OnInit. scanned disk, found files, created window with list (Controls).

2. from the dialog box (file listing) got the file name.

OnChartEvent. Process the mouse clicks; we know what line in the list was clicked, respectively, we know the file.

3. Opened file by file name, got data, processed.

OnChartEvent. Process mouse clicks on the "Go" button. Received the name of a file from the list. Further is purely your data processing of this file.

4. Exit the programme.

ExpertRemove()

 
sergeev:
...

Well, that clears things up now, thanks.

But, just to try it out, I made an Expert Advisor. It prints even when nothing happens on the chart - and it shouldn't:

#include <Controls\ControlsDialog.mqh>
CControlsDialog ExtDialog;

int OnInit()
{
//--- create application dialog
  if(!ExtDialog.Create(0,"Controls",0,20,20,360,324))
    return(-1);
//--- run application
  ExtDialog.Run();
  return(0);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy dialog
  ExtDialog.Destroy();
}
//+------------------------------------------------------------------+
//| Expert chart event function                                      |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,         // event ID  
                  const long& lparam,   // event parameter of the long type
                  const double& dparam, // event parameter of the double type
                  const string& sparam) // event parameter of the string type
{
  ExtDialog.ChartEvent(id,lparam,dparam,sparam);
  Print("dsfsdfsdfsdf");
}
//+------------------------------------------------------------------+
 
Yedelkin:

Well, any class method is just plain code. Try parsing this code here:

Thank you! Got it working.
 
joo:

Well, that clears things up now, thanks.

But, just to try it out, I made an Expert Advisor. It prints even when nothing happens on the chart - and it shouldn't:

No, no, it prints because you're moving the mouse over the chart.

 
sergeev:

No, there's a print going on because you're moving the mouse over the chart.

Indeed, I have sinned - I have moved the mouse over the chart, that's why it prints.
 

Good afternoon.

Question out of curiosity. Here's the code:

class cl2;

class cl1
{
public:
        int q;
        void fn2(cl2 &t){t.i = 87;}
};


class cl2
{
public:
        int i;
        void fn(cl1 &w){w.q = 9;}
};

The idea is as follows:

  • There are two classes (#1 and #2).
  • Class #1 is poking around in class #2
  • Class #2 is poking around in class #1.

It compiles in MQL without errors, it won't compile in VS (it says I can't use undefined classes). Why?

 
220Volt:

It compiles in MQL without errors, it won't compile in VS (says you can't use undefined class). Why?

Patamushta mql5 is better!

;)

 
MetaDriver:

Because mql5 is better!

;)

Yes, perhaps I should give a plus sign ))
Reason: