Errors, bugs, questions - page 136

 
Renat:
Indicator created from Expert Advisor will not be unloaded until you explicitly delete it or Expert Advisor is finished.

Thank you for taking the time to reply.

This changes a lot, it means we can do without separating the code for the tester and the code for the real.

 
Renat:

Advice on how best to save resources if the indicators are needed once an hour :

leave a dozen of standard indicators to hang out at every tick or

Unload them after each use via IndicatorRelease(indicator_handle), and then load them again after one hour.

But the second variant increases the time of testing.

Also answer how much delay on average is required to load one mask?

 
Urain:

Advice on the best way to save resources if the indicators are needed once an hour :

leave a dozen of standard indicators to hang on each tick or

The best thing to do is not to unload them (indicators are hardly needed really "once an hour"), but:

  1. increase memory size with transition to 64 bits, or
  2. reduce the depth of history charts
The exact time of loading is impossible to say - it depends on several factors. It's better not to create problems by unloading indicators - this may cause problems because of the asynchronous processes of creation and recalculation of the indicator.
 
Urain:

Advice on the best way to save resources if the indicators are needed once an hour :

leave a dozen of standard indicators to hang out at every tick or

Unload them after each use via IndicatorRelease(indicator_handle), and then load them again after one hour.

But the second variant increases the time of testing.

Also answer how much delay on average is required to load one mask?

If you don't use timer for other purposes, try to send data to the timer at the required interval.
 

Question

I don't use offset settings at all, but happened to see a description on alligator, started thinking... :)

Description of one of the alligator settings:

teeth_shift

[in] Red line shift relative to the price chart. It should be remembered that the shift of the line is purely visual for displaying, and values in the indicator buffer are stored without any shift. When the buffer values are obtained using the CopyBuffer() function, the offset value will have no effect.

Although it's not mentioned in description of MA, but I think it's an error and everything is similar

ma_shift

[in] Shift of indicator relative to price chart.

In the picture where the yellow birdie is, the price has crossed the MA without a shift. It is clear here, for example, the price at the close of the previous bar is higher than the MA and the price at the open of the current bar is opened.

But where the green bird is, how do we know the same thing? I.e. when the price visually crosses the MA with the shift

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов - Документация по MQL5
 
Hello, I wrote a script to get an Ask price for EURUSD
#include <Trade\SymbolInfo.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
  CSymbolInfo SymInfo;
  Alert(SymInfo.Ask());
  }
It returns 0 - I think I need to bind
CSymbolInfo SymInfo;
to the chart symbol, but I don't know how to specify the class symbol
 
kirill190982:
Hello, I wrote a script - getting Ask price for EURUSD gives out 0 - I think I need to bind
to the chart symbol, but I don't know how to specify the class symbol
First of all, let's find out what the class is all about. To solve the problem you should use methods Name and RefreshRates of this class.
 
Interesting:
The first thing to do is to familiarise yourself with what the class is all about. When linking to the symbol, you should first use the "Name" method of the class.
//+------------------------------------------------------------------+
//|                                                   SymbolInfo.mqh |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//|                                              Revision 2010.02.22 |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Class CSymbolInfo.                                               |
//| Appointment: Class for access to symbol info.                    |
//+------------------------------------------------------------------+
class CSymbolInfo
  {
protected:
   string                      m_name;               // symbol name
   MqlTick                     m_tick;               // structure of tick;
.....
//--- ask parameters
   double            Ask() const                      { return(m_tick.ask); 
I understand that Ask in the class is determined by the MqlTick structure.
#include <Trade\SymbolInfo.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
  string Megasymbol=Symbol();
  CSymbolInfo SymInfo;
  SymInfo.Name(Megasymbol);
  Alert(SymInfo.Ask());
  }
still get zero results.
 
kirill190982:
I understand that Ask in a class is defined by the MqlTick structure; I tried it both ways and still get zero

You should do the following

SymInfo.Name("EURUSD");
SymInfo.RefreshRates();
Print(SymInfo.Ask());
 
Interesting:

How about trying it this way?

Thank you
Reason: