Questions from Beginners MQL5 MT5 MetaTrader 5 - page 917

 
Artyom Trishkin:

Thank you!

 
Vitaly Muzichenko:

Use if() constructions

thank you!

 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 

Good evening.

Can you tell me if there is an option to include commission when creating your own symbol and testing an EA on it? If so, how?

 
ISL:

when creating your own symbol and testing an EA on it, should you include a commission? If so, how?

In which metatrader do you create symbols on MT5?

 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 

Hello! I've asked this question before but no one has answered, I'll try to explain it in more detail...


//+------------------------------------------------------------------+
//|                                                         test.mq5 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

class MyClass                                     1. СОЗДАЮ КЛАСС 
  {
private:

public:
                     MyClass();
                    ~MyClass();
   void              MyFunction();               2.В КЛАССЕ ОБЬЯВЛЯЮ СВОЮ ФУНКЦИЮ
  };
MyClass::MyClass()
  {
  }
MyClass::~MyClass()
  {
  }
void MyClass::MyFunction()                     
  {
  }

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
//--- plot Label1
#property indicator_label1  "Label1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- input parameters
input int      Input1=1;
//--- indicator buffers
double         Label1Buffer[];
MyClass *PointMyClass;                            3. СОЗДАЮ УКАЗАТЕЛЬ НА СВОЙ КЛАСС          
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Label1Buffer,INDICATOR_DATA);
//---
   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[])
  {
//---
   PointMyClass.MyFunction();                         4. Здесь пытаюсь обратиться к своей функции - выдает сообщение -invalid pointer access in .. \
                                                    
                             
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
Помогите разобраться
 
Tango_X:

Hello! I have asked this question before but no one has answered, I will try to explain in more detail...

 
ISL:

Can you tell me if it is possible to include a commission when creating your own symbol and testing an EA on it?

No.

 
fxsaber:

Thank you! I always thought referring to classes was a pointer to a class. But here it's just a declaration... what's that got to do with it?

Reason: