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

 
ruslan:

there is a constant in the OPENCL cl_ inline and it is equal to #define CL_DBL_MAX 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0 by double-checking the degree of two in 1024 got. 2^1024 = 179769313486231590772930519078902473361797697894230657273430081157732675805500963132708477322407536021120113879871393357658789768814416622492847430639474124377767893424865485276302219601246094119453082952085005768838150682342462881473913110540827237163350510684586298239947245938479716304835356329624224137216 And then below that is the number of pi

after

#define CL_M_PI 3.141592653589893115998

3.141592653589793238462643383279502884197169

explain why ????

https://ru.wikipedia.org/wiki/Число_двойной_точности

Число двойной точности — Википедия
  • ru.wikipedia.org
Числа с плавающей запятой (двойной/одинарной/четверной точности) поддерживаются сопроцессором (до 80486SX, включительно, выполнен как отдельный модуль-0х87/0х287/0х387/0х487, начиная с 80486DX является встроенным в главный процессор. Сопроцессор, хотя он сейчас и является частью главного процессора, принято называть FPU — Floating Point Unit...
 
Is it possible to get the balance value on previous bars in mcl4? How do I write this in the code?
 
My indicator has a delay of +/- 1 second after the button is pressed. MQL5

I have added these event handlers for operation and update of the panel:
- OnChartEvent for handling button clicks
- OnTimer for panel data update

The whole code is 750+ lines, there are only several loops, one for updates in the indicator window, the other three have a small number of passes (max 10 * 4)

This part of code after OnChartEvent if(id == CHARTEVENT_OBJECT_CLICK) is noticeably slow
if(go == "E")
     {
      if(ObjectGetInteger(ChartID(),no,OBJPROP_STATE) == true)
        {
         ObjectSetInteger(ChartID(),no,OBJPROP_COLOR,cpanel);
         ObjectSetInteger(ChartID(),no,OBJPROP_BGCOLOR,ctext);
        }
      else
        {
         ObjectSetInteger(ChartID(),no,OBJPROP_COLOR,ctext);
         ObjectSetInteger(ChartID(),no,OBJPROP_BGCOLOR,cpanel);
        };
      for(int i = 0; i < limit_x; i++)
        {
         vname = i + 1;
         if("MCC B№"+(string)vname != no)
           {
            ObjectSetInteger(ChartID(),"MCC B№"+(string)vname,OBJPROP_STATE,false);
            ObjectSetInteger(ChartID(),"MCC B№"+(string)vname,OBJPROP_COLOR,ctext);
            ObjectSetInteger(ChartID(),"MCC B№"+(string)vname,OBJPROP_BGCOLOR,cpanel);
           };
        };
     };
 
Alexandr Sokolov:
My indicator has a delay of +/- 1 second after the button is pressed. MQL5

I have added these event handlers for operation and update of the panel:
- OnChartEvent for handling button clicks
- OnTimer for panel data update

The whole code is 750+ lines, there are only several loops, one for updates in the indicator window, the other three have a small number of passes (maximum 10 * 4)

This part of code after OnChartEvent if(id == CHARTEVENT_OBJECT_CLICK) is noticeably slow

ChartRedraw() is needed after all changes have been made to all objects whose properties are changed by the button action.

 
Artyom Trishkin:

ChartRedraw() is needed after making all changes in all objects whose properties are changed with button action.

Indeed! I hadn't thought of that. Thank you very much!


I was putting alerts inOnChartEvent if(id ==CHARTEVENT_OBJECT_CLICK) - there were alerts, no updates. And that's why I couldn't understand why

 
novichok2018:
Is it possible to get the balance value on previous bars in mcl4? How do I write it in the code?

Hello, experts! Doesn't anyone know?! I don't believe it.

 
novichok2018:

Hello, experts! Doesn't anyone know?! I don't believe it.

Here is the price of one tick

SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE ) * volume

Then multiply by the difference in ticks between the order open price and the Close (or other) price of the needed bar. But take into account that you cannot know using the standard methods what the spread was at that moment in time

 
novichok2018:

Hello, experts! Doesn't anyone know?! I don't believe it.

the balance depends on the closing of positions - if nothing was closed, then the balance did not change

 
I must not have phrased the question correctly, since the answers are off-topic. I don't care if the positions have closed or not, and I'm certainly not interested in the value of the tick. I need to know what theaccount balance was at the time of closing 1, 2, 3 bars of a certain symbol for comparison. Positions on these bars were opened and closed, including positions on other symbols: some positions were closed on the plus side, some were closed in the minus side, some were not closed yet, therefore the balance has changed. I need to know the specific values. Thank you.
 
novichok2018:
I must not have phrased the question correctly, since the answers are off-topic. I don't care if the positions have closed or not, and I'm not interested in the cost of the tick. I need to know what the account balance was at the time of closing 1, 2, 3 bars for comparison. Positions were opened and closed on these bars, and therefore the balance was changing. We need to know the specific value. Thank you.

- We look at the time of the last bar
- add up everything that was closed on this bar
- subtract from the current balance

and so all the bars in turn