Download MetaTrader 5
To add comments, please log in or register
What is the best place to find a programmer? Freelance service!
NTFS
650
NTFS 2013.04.01 09:39 
//+------------------------------------------------------------------+
//|                                                       PerSep.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
#include    <Charts\Chart.mqh>
string gSymbol = "EURUSD";

void OnStart()
  {
//---
 bool lRez;
      CChart lChart;
      lChart.Open(gSymbol, PERIOD_M15);
      lChart.ApplyTemplate("blank");     // You have to modifiy this code to use your template
      lChart.SetInteger(CHART_AUTOSCROLL,0);
      lChart.SetInteger(CHART_SHIFT,1);
      lChart.SetInteger(CHART_SHOW_PERIOD_SEP,1);
      lRez=lChart.Navigate(CHART_END,-960);
      lChart.Redraw();

      //MqlRates rates[];
      //ArraySetAsSeries(rates,true);
      //int copied=CopyRates(gSymbol,PERIOD_D1,0,gHistoryDeepth,rates);
      //Print("date=", TimeToString(rates[xNumber].time));
      Sleep(10000);
  }
//+------------------------------------------------------------------+

Hello!

I run the script above.

Somehow   lChart.SetInteger(CHART_SHOW_PERIOD_SEP,1); doesn't work.

Anyone experiences the same thing?

Build 787

Thank you! 

Alain Verleyen
Moderator
30297
Alain Verleyen 2013.04.01 09:51  
ns_k:

Hello!

I run the script above.

Somehow   lChart.SetInteger(CHART_SHOW_PERIOD_SEP,1); doesn't work.

Anyone experiences the same thing?

Build 787

Thank you! 

Use :

   lChart.ShowPeriodSep(true);

If you use a class (CChart) then use its methods and properties.

If you use SetInteger, then set correct value type, CHART_SHOW_PERIOD_SEP is a bool (true or false), not an integer (1).

NTFS
650
NTFS 2013.04.01 18:08  
angevoyageur:

Use :

If you use a class (CChart) then use its methods and properties.

If you use SetInteger, then set correct value type, CHART_SHOW_PERIOD_SEP is a bool (true or false), not an integer (1).

Hello!

I tried both ways, but it didn't work out.

//+------------------------------------------------------------------+
//|                                                 CChartTEST03.mq5 |
//|                        Copyright 2013, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2013, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
#include    <Charts\Chart.mqh>
string gSymbol = "EURUSD";
void OnStart()
  {
      CChart lChart;
      lChart.Open(gSymbol, PERIOD_M15);
      lChart.ApplyTemplate("blank");     // You have to modifiy this code to use your template
      lChart.SetInteger(CHART_SHOW_PERIOD_SEP,true);
      lChart.ShowPeriodSep(true);
      lChart.Redraw();
      while(!IsStopped()) {};
  }

 Chart is presented in MT5 but period separators are just not shown. If I hit Crtl+Y they are displayed though.

 Any help would be much appreciated!

Thank you! 

Alain Verleyen
Moderator
30297
Alain Verleyen 2013.04.01 18:43  
ns_k:Thank you! 

Seems a bug. If I add this code, it works :

      Print("Chart separator : ", lChart.ShowPeriodSep());

That give :

void OnStart()
  {
      CChart lChart;
      lChart.Open(gSymbol, PERIOD_M15);
      lChart.ApplyTemplate("blank");     // You have to modifiy this code to use your template
      Print("Chart separator : ", lChart.ShowPeriodSep());
      lChart.ShowPeriodSep(true);
      lChart.Redraw();
      while(!IsStopped()) {};
  }

You can write to ServiceDesk.

Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
NTFS
650
NTFS 2013.04.01 19:01  
angevoyageur:

Seems a bug. If I add this code, it works :

That give :

You can write to ServiceDesk.

I'll use the workaround and report a bug. Thank you!
/
To add comments, please log in or register