Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1388

 
Artyom Trishkin:

Try it.

Trying it. First impression is that 3 or 4 tools are loaded, while 10 are needed
The stories are uploaded for all of them.
 
Valeriy Yastremskiy:
Trying it. First impression is that 3 or 4 tools are loading, but I need 10
The stories are loaded on all of them.

I don't know then - it's been a long time since I opened a quad

 

I opened mt4 to check the algorithm quickly.

It's very strange that it works correctly in the tester, but after installing it on a real account it reverses trades. The code is simple, only 2 indicator buffers


 
MakarFX:
Thank you very much for your help. I have redesigned this part of the code and with the price filter enabled, the pending orders are now set without errors. Only those signals are skipped when the pending order is still hanging. As intended. Thank you very much once again))) I just have a question - there are some places where there was a signal but the pending one was not set and there were no errors. So, there were no suitable conditions in this place and it's OK, you can live with confidence?))) And there were no pending orders in this place either...
 
DanilaMactep:
Thank you very much for your help. I have redesigned this part of the code and with the price filter enabled, the pending orders are now set without errors. Only those signals are skipped when the pending order is still hanging. As intended. Thank you very much once again))) I just have a question - there are some places where there was a signal but the pending one was not set and there were no errors. So, there were no suitable conditions in this place and it's OK, you can live without worry?)))) And there were no pending orders in this place, either...
If there weren't suitable conditions and it's normal, you can live with it.
 
Artyom Trishkin:

Then I don't know - it's been a long time since I opened a quad

Wrong, the data from the other instruments the tester takes is current. Just from here (from other instruments) you can calculate the difference from the current time. If it's close to the current time, and the history is loaded, you can make a shift to the tester time. It's a crutch).

 

Question: a panel is created with a size of 370, how do I resize to 200 when compressing the graph ?

#property strict

#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots   0

#include "PanelDialog.mqh"
//+------------------------------------------------------------------+
//| Global Variables                                                 |
//+------------------------------------------------------------------+
CPanelDialog ExtDialog;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
//--- create application dialog
   if(!ExtDialog.Create(0,"Spread",0,12,12,250,370))
     return(INIT_FAILED);
//--- run application
   if(!ExtDialog.Run())
     return(INIT_FAILED);
//--- ok
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy application dialog
   ExtDialog.Destroy(reason);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[])
  {
//---
 
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   ExtDialog.ChartEvent(id,lparam,dparam,sparam);
  }
//+------------------------------------------------------------------+
 
Vitaly Muzichenko:

Question: a panel is created with a size of 370, how do I resize to 200 when compressing the graph ?

And how do you define graph compression?
 
MakarFX:
And how do you define graph compression?
   if(id==CHARTEVENT_CHART_CHANGE) {
      // ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS); // Высота графика
   }
 
Vitaly Muzichenko:

If compression in height

   int ChartHigh=(ChartGetDouble(0,CHART_PRICE_MAX,0)-ChartGetDouble(0,CHART_PRICE_MIN,0))/Point; //высота графика в пунктах
   if(ChartHigh>500)  
      ExtDialog.Create(0,"Spread",0,12,12,250,200)
   else
      ExtDialog.Create(0,"Spread",0,12,12,250,370)

if compression across the width

   if(ChartGetInteger(0,CHART_SCALE,0)>2) 
      ExtDialog.Create(0,"Spread",0,12,12,250,200)
   else
      ExtDialog.Create(0,"Spread",0,12,12,250,370)
in width you can also CHART_VISIBLE_BARS