[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 318

 
svlukinova:
Please help. Since yesterday, to be exact from 22:59, stopped charts and still no updates and the rate and hangs since yesterday without change. I already reset everything. I don't know where to click to get the exchange rate back to real time.


The market is resting - so should you.

The market opens on Monday in Tokyo. Closes on Friday in Chicago. Opens around 2 a.m., closes around 10 or 11 p.m. (Moscow or Kievtime zone ). Saturday/Sunday is a weekend.

 
drknn:


The market rests - so rest you.

The market opens on Monday in Tokyo. Closes on Friday in Chicago. Opens around 2 a.m., closes around 10 or 11 p.m. (Moscow or Kiev time zone)

Thank you very much!))) It makes me laugh. I just started working on Tuesday and didn't know that the market was off at the weekend:))
 
Zhunko:
There is no function, but it can be made in MQL4 + WinAPI.

//+------------------------------------------------------------------+
//|          Function  : int GetChartScale()[1,2,4,6,13]             |
//|          Copyright © 2012, XrustSolution.  mail:xrustx@gmail.com |
//|          https://www.youtube.com/user/opmlv http://forexrust.info |
//+------------------------------------------------------------------+
//|          Description: Возвращает ширину свечи по масштабу чарта  |
//+------------------------------------------------------------------+
#import "user32.dll"
  bool GetWindowRect(int h, int& pos[4]);
#import
//+------------------------------------------------------------------+
int GetChartScale(){
        int h = WindowHandle(Symbol(), Period());
        int rect[4];
        if(h==0) return(1);
        GetWindowRect(h, rect);
        int wW  = rect[2] - rect[0]; // ширина окна
        int bpc = WindowBarsPerChart();
        if(bpc==0) return(1);
        int scale = MathFloor((wW-48)/bpc);
        switch(scale){
                case  1 :       return(0);
                case  2 :       return(1);
                case  4 :       return(2);
                case  8 :       return(3);
                case 16 :       return(6);
                case 32 :       return(13);
                default :   return(1);
        }
        return(1);
}
//+------------------------------------------------------------------+
 

Good afternoon! Can you please tell me why the indicator line is not displayed, the code seems to be elementary and nothing complicated. I checked it with Print (T_V) - it gives the value, but the line is not displayed for some reason?

I would like to add a question. I have deleted the indicator and put it on a chart again and the line is displayed. Why is the indicator not recalculated during compilation?

#property indicator_separate_window
#property indicator_minimum -3
#property indicator_maximum 3
#property indicator_buffers 1
#property indicator_color1 Red
#property indicator_level1 0.0         //горизонтальный уровень N в отдельном окне индикатора, где N от 1 до 8 
#property indicator_levelcolor Black   // цвет горизонтальных уровней индикатора е 
#property indicator_levelwidth 1       //толщина горизонтальных уровней индикатора
double T_Vol[];

int init()
  {  SetIndexBuffer (0, T_Vol); 
     SetIndexStyle  (0, DRAW_HISTOGRAM, STYLE_SOLID, 1); 
     IndicatorDigits(Digits);
   return(0); }
int start(){
   int limit;
   int сounted_bars=IndicatorCounted();
   if (сounted_bars==0) limit=Bars-1;
   if (сounted_bars>0) limit=Bars-сounted_bars-1;
   for(int i=limit;i>=0;i--){
       int T_V=0; 
       if (Volume[i]>Volume[i+1])T_V=1;
       if (Volume[i]<Volume[i+1])T_V=-1;
       T_Vol[i]=T_V;
   }
   return(0);
}
 
PapaYozh:


1.

What is the value of the variable "SignalBar" and is the indicator calculated on this bar?

Perhaps SignalBar=0 and the indicator does not calculate the 0th bar.

2.

Yes, during visual testing the indicator buffers are not displayed until the testing is completed or interrupted. But the indicators do count.

Thanks for pointing it out! But nothing helps so far :(

So now I`m studying the indicator migration in Expert Advisor. If you have any wise advice, I won't refuse it ! :)

 

Hi all!

I've been studying programming as an amateur, I haven't programmed for a long time, so I have a question:

Why do I need breakpoints in MQL4, if after setting them nothing happens at compilation? I used to program a lot in C#, where there was a pause in program execution and you could see the values of variables, which functions were called and errors listed. But here I press Compile and nothing happens. Or you may enable Debug somehow, I just don't know how?

 

there is a function "double MathRound( double value)", but I need the rounding to a larger decimal fraction, and if the number is integer or already decimal, then leave it alone.

For example: 1) 0.744 round to 0.8; 1.233 round to 1.3

2) 0.9 or 3 or 1.5 do not touch.



Who can help, please?
 

I wonder if you even know that there is a complete and detailed Documentation of the language?

NormalizeDouble

 
FAQ:

I wonder if you even know that there is a complete and detailed Documentation of the language?

NormalizeDouble

upwards, it's kinda easy for you, eh?...
 
okvseok:
upwards, it's a bit simple, isn't it...?

You can translate a number into a string and write a function to process the characters of this string. It's not complicated here - we only round up if the number has more than one digit after the decimal point.
Reason: