Discussion of article "Use of Resources in MQL5" - page 2

[Deleted]  
thanks.
 

Using resources in the tester should work ? It's not working. Error 4802.

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots   1

#resource "\\Indicators\\Examples\\ADX.EX5"
#property tester_indicator "\\Indicators\\Examples\\ADX.EX5"
//+------------------------------------------------------------------+
//||
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   int handle=iCustom(Symbol(),Period(),"::Indicators\\Examples\\ADX.EX5");
   if(handle!=INVALID_HANDLE)
     {
      ChartIndicatorAdd(0,1,handle);
     }
//---
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
  
  return(rates_total);}

	          
 
Karlson:

Using resources in the tester should work ? It's not working. Error 4802.

What do you really want to do?

Override the calculation function OnCalculate of this indicator in an external indicator with its own calculation engine? You can't do that.

 
Yes. I wanted my indicator to receive data from Zigzag. And to include it as a resource.
 

But to check the indicator in the tester you still need the presence of the locking mechanism itself.

if(MQL5InfoInteger(MQL5_TESTING)==true) // if tester, get from the folder
     {
      f_h=iCustom(_Symbol,_Period,"Examples\\Zigzag",5,5,3);
     }
   else                                 // if on the chart, we use the built-in
     {
      f_h=iCustom(_Symbol,_Period,"::Indicators\\Examples\\Zigzag.EX5",5,5,3);
     }

Another option is to embed the safety lock completely.

 

Forum on trading, automated trading systems and testing trading strategies

Discussion of the article "Using Resources in MQL5".

Renat, 2013.01.16 22:21

This was added in the 730 build on 24 November 2012:

  • MQL5: Added support for storing indicators in EX5 resources. Indicators in resources will not be able to work with their own resources.
Could you please tell me how to create a graphical object of OBJ_BITMAP_LABEL type in an indicator loaded from resources and overlay text from TextOut on it?
Can we make an exception only for TextOut - the ability to work with its own resources of programmes loaded from resources?
 
fyords:
Could you please tell me how it is possible to create a graphical object of OBJ_BITMAP_LABEL type in the indicator loaded from resources and overlay on it the text from TextOut?
Can only for TextOut make an exception - the ability to work with its own resources of programmes loaded from resources?
And in what place exactly the problem? What exactly does not work?
 
Renat:
Where exactly is the problem? What exactly does not work?

There is an indicator, from it the child one is launched, from resources.
TextOut is used in the child one, and the result is loaded to OBJ_BITMAP_LABEL via ResourceCreate, but there is no possibility to use resources in the resource.

The result is that the object appears, the resource is specified in the properties, but the text itself is not output.

 
fyords:

There is an indicator, from it a child is launched, from resources.
TextOut is used in the child, and the result is loaded to OBJ_BITMAP_LABEL via ResourceCreate, but there is no possibility to use resources in the resource.

The result is that the object appears, the resource is specified in the properties, but the text itself is not output.

Yes, it is currently impossible to load resources from a resource object.

In fact, the situation looks like this: the indicator "pulled" from a third-party resource starts to live within the called module and all its calls to resources go to the body of the called module, not to the native body. We are currently thinking about this problem and most likely we will solve it.

 
Renat:

... We are thinking about this problem now and will probably solve it.

Thank you, I'll be waiting.