[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 543

 
Pyro:
And I, as I'm not familiar with principles of data exchange and caching, am seriously asking this:) Well, I don't know how it happens there. It seems that GV are stored in RAM, then dumped to disk. Had my suspicions at one point. Anyway, I want to understand if it's OK to refer to Global Variables on every tick.

IMHO this is not normal. I have data read from files into static variables in init() function, and written only after the information has changed.

I don't understand, why every tick read data from global variables? I don't always read static ones either, but only as needed.

GV is not used, because at a time I need to read or write values for dozens of variables, so there is less work with files, than with these very variables one by one.

 

So... Opinions are divided. This is already interesting. Why is it needed - GVs are used to exchange information between different instruments. For example, on one currency pair the Expert Advisor works for sell, on another pair the Expert Advisor should know about it. We create a global variable sell1 with values of 1 or 0. The values of variables sell1,sell2...buy1,buy2 etc. should be continuously checked.

 
Please tell me which script can be used to write online quotes of any TF into an Excel file and work with this Excel file, i.e. the Excel file should be open? Example: let's write in an M15 Excel file with MT4, by columns: time, open, high, low, low, lowes, volume and in this case we have a calculation prepared in advance by the algorithm, i.e. the formula extends to the end of the sheet with links to the cells of the recorded data.I.e. the calculation formula is stretched to the end of the sheet with links to the cells of the recorded data, in codebase I found only this https://www.mql5.com/ru/code/8175 , but as I understand it is not quite the same, it writes bids and asks.
 

Can you tell me how to avoid error modify 1?

for(i=0;i<OrdersTotal();i++)
    {
    if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
      if(OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol())
        {
        if(NormalizeDouble(OrderStopLoss(),Digits) != stoploss)
          {
          OrderModify(OrderTicket(),OrderOpenPrice(),stoploss,OrderTakeProfit(),0);
          }
        }
      }
    }
 
sss2019:

Can you tell me how to avoid error modify 1?


for(i=0;i<OrdersTotal();i++)
    {
    if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
      if(OrderMagicNumber() == MagicNumber && OrderSymbol() == Symbol())
        {
        if(MathAbs(OrderStopLoss()-stoploss)>=Point)
          {
          OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(stoploss,Digits),OrderTakeProfit(),0);
          }
        }
      }
    }
 
PapaYozh:


Thank you
 
Dear Professionals, could you tell me... I need to highlight a particular candle in the chart, if the indicator fulfils some condition, for example, the volume is higher than a specified value. Can you change the colour of this candlestick, or something else?
 
Which function closes all open positions?
 
kon12:
Dear Professionals, could you tell me... I need to highlight a particular candle in the chart, if the indicator meets some condition, for example, the volume is higher than a specified value. Can you change the colour of this candlestick, or something else?
Example:
Files:
bars.mq4  4 kb
 
DOCTORS:
Which function closes all open positions?

Here. Actually, search is said to rule through google: "close all" site:mql4.com
Reason: