Requests & Ideas (MQL5 only!) - page 22

 
Vladimir Karputov :

By the way, here's the question: I create the object as standard

But the problem is created: the leftmost button has the index "0", then "1" and so on ascending .... And this numbering does not coincide with the name of the bars (# 5, # 4, # 3, # 2, # 1, # 0):

What is the best way to solve the problem?


I dont know ...

I suggested this numberation (0 as an open bar, 1 - close / previous bar, 2nd bar, etc.) simply because it's the same for MT4 (because it's understandable for users who use MT4). So, if they see this numbering, they can say - "this is the same as for MT4, and we like it." ...

And the 5th bar is not 0 bars
:)

I dont know ...
We can use other bar names ...

 

Different names of the bars:

#0 = open bar = open = zero-bar = zero
#1 = first bar = first = 1st = one = previous = prev
#2 = second bar = second = 2nd = two
#3 = third bar = third = 3rd = three
#4 = fourth bar = fourth = 4th = four
#5 = fifth bar = fifth = 5th = five

 

Light show:

Start testing "EveningStarPanel". 

The indicator consists of three files:

  1. An Indicator "EveningStarPanel"
  2. A panel "PanelDialog"
  3. An included file "PictureGroupBrb.mqh"


Panel "PanelDialog" should be in one folder with the indicator "EveningStarPanel":

one folder

An included file "PictureGroupBrb" should be in one folder "\Include\Controls\PictureGroupBrb.mqh":

Include folder

At this stage only check of input parameters - names of symbols is realized. The panel doesn't work yet.

EveningStarPanel: version 1.003
PanelDialog: version 1.003
PictureGroupBrb: version 1.003


 

Forum on trading, automated trading systems and testing trading strategies

Requests & Ideas (MQL5 only!)

Vladimir Karputov, 2017.06.08 12:26

By the way, here's the question: I create the object as standard

Create objects

But the problem is created: the leftmost button has the index "0", then "1" and so on ascending .... And this numbering does not coincide with the name of the bars (# 5, # 4, # 3, # 2, # 1, # 0):

numbering does not coincide with the name of the bars

What is the best way to solve the problem?



The question of numbering is solved.

By default, the index is calculated by the formula:

Resulting index = Total number of elements - 1 - index

 
Unfortunately in a bilda of 1607 when debugging on historical data the error is noticed: in indicators OnTimer doesn't work (). 

Therefore I can't give a panel to testing.

By the way, you can check OnTimer () in the indicator like this:

//+------------------------------------------------------------------+
//|                                                  TestOnTimer.mq5 |
//|                              Copyright © 2017, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2017, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.00"
#property indicator_chart_window 
#property indicator_buffers 0
#property indicator_plots   0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   if(!EventSetTimer(3))
      if(!EventSetTimer(3))
         if(!EventSetTimer(3))
           {
            Print("Error create timer! THREE attempts!");
            return(INIT_FAILED);
           }
//---
   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);
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
   static long count=0;
   count++;
   Comment(count);
   int f=0;
  }
//+------------------------------------------------------------------+

Next, in MetaEditor run Debugging on History Data.

You will see that the counter does not work in the chart window (the upper left corner).
Files:
 

Forum on trading, automated trading systems and testing trading strategies

Requests & Ideas (MQL5 only!)

Vladimir Karputov, 2017.06.08 15:07

Light show:

Start testing "EveningStarPanel". 

The indicator consists of three files:

  1. An Indicator "EveningStarPanel"
  2. A panel "PanelDialog"
  3. An included file "PictureGroupBrb.mqh"


Panel "PanelDialog" should be in one folder with the indicator "EveningStarPanel":

one folder

An included file "PictureGroupBrb" should be in one folder "\Include\Controls\PictureGroupBrb.mqh":

Include folder

An included file "PatternEveningStarBrb" should be in one folder "\Include\Expert\PatternBrb\PatternEveningStarBrb.mqh":

Include folder

At this stage only check of input parameters - names of symbols is realized. The panel doesn't work yet.

EveningStarPanel: version 1.004
PanelDialog: version 1.007
PictureGroupBrb: version 1.004
PatternEveningStarBrb.mqh: version 1.000


Temporarily, a workaround is made for the error associated with calling OnTimer () in the indicators when debugging on historical data:

EveningStarPanel.mq5::OnCalculate

//+------------------------------------------------------------------+ 
//| 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[])
  {
   if(prev_calculated==0)
      return(rates_total);
   OnTimer();
   return(rates_total);

and EveningStarPanel.mq5::OnTimer

//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
   static datetime prev_time=0;
   datetime time_current=TimeCurrent();
   if(time_current-prev_time<3)
      return;
   prev_time=time_current;
//---
   ExtDialog.LightShow(InpGap,InpCandle2Type,InpCandleSizes);
  }

df

 
Vladimir Karputov:
Unfortunately in a bilda of 1607 when debugging on historical data the error is noticed: in indicators OnTimer doesn't work (). 

Therefore I can't give a panel to testing.

By the way, you can check OnTimer () in the indicator like this:

Next, in MetaEditor run Debugging on History Data.

You will see that the counter does not work in the chart window (the upper left corner).

While in build 1607 there are problems with debugging indicators on historical data, I will temporarily freeze the project "EveningStarPanel".

But there was such an idea: with the help of Scientific Charts to display the number of found patterns "Evening Star". Something like that:

Pattern Evening Star

 
"EveningStarPanel" in the form of an archive (the instruction will be below).
Files:
MQL5.zip  11 kb
 

Instructions how to install "EveningStarPanel" from the archive.

1. Upload the archive to your computer. Click on the attached archive file:

Download MQL5.zip

2. As a result, the archive will be downloaded to your computer:

Downloaded file

3. Go to the "Downloads" folder and copy the downloaded archive.

4. In the MetaTrader 5 terminal or in the MetaEditor editor, click the "File" -> "Open Data Folder" menu.

5. In the opened folder, paste the previously copied archive:

paste the previously copied archive

6. Now the most important thing: right click on the archive and select the menu "Extract all ..."

7. It is not right:

It is not right

8. It is right:

It is right

 
Vladimir Karputov:

While in build 1607 there are problems with debugging indicators on historical data, I will temporarily freeze the project "EveningStarPanel".

But there was such an idea: with the help of Scientific Charts to display the number of found patterns "Evening Star". Something like that:



EveningStarStatistics version 1.000

The indicator shows the number of "Evening Star" patterns in the specified date range.

Here is the work of the indicator "EveningStar":

Скриншоты торговой платформы MetaTrader

RTS-9.17, D1, 2017.06.14

MetaQuotes Software Corp., MetaTrader 5, Demo

Evening Star

RTS-9.17, D1, 2017.06.14, MetaQuotes Software Corp., MetaTrader 5, Demo


And the work of the indicator EveningStarStatistics:

Скриншоты торговой платформы MetaTrader

RTS-9.17, D1, 2017.06.14

MetaQuotes Software Corp., MetaTrader 5, Demo

Evening Star Statistics

RTS-9.17, D1, 2017.06.14, MetaQuotes Software Corp., MetaTrader 5, Demo


As you can see in the given date range (current date minus one year) five patterns are found.