Errors, bugs, questions - page 708

 

Hello OpenCL! In debug mode code works great.... But in tester it gives error 5100 when calling CLContextCreate... Service Desk?

Terminal CPU: GenuineIntel Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz with OpenCL 1.1 (4 units, 2095 MHz, 5990 Mb, version 2.0)

Terminal GPU: Advanced Micro Devices, Inc. Turks with OpenCL 1.1 (6 units, 725 MHz, 1024 Mb, version CAL 1.4.1703 (VM))

Build 619 Windows 7 SP1 64-x

...

Repeated it on PC with another videogame - didn't help...

Files:
 
MigVRN:

In debug mode code works great.... But in tester it generates error 5100 when CLContextCreate is called... Service Desk?

I don't think it's a bug, I think OpenCL doesn't work in the tester - support is disabled. Temporarily disabled or permanently, it's an open question.
 
MigVRN:

Hello OpenCL! In debug mode code works great.... But in tester it gives error 5100 when calling CLContextCreate... Service Desk?

...

Repeated it on the desktop with a different videogame - didn't help...

I don't remember announcing that OpenCL was enabled in the tester, maybe I've missed something.

As long as the functionality is debugged in the terminal, as soon as it's ready support in the tester will be switched on.

There will have to support remote testing as well.

 
MetaDriver:
I don't think it is a bug. I think OpenCL does not work in the tester - support is disabled. Temporarily disabled or permanently, it's an open question.
Urain:

I don't recall it being announced that OpenCL was enabled in the tester, maybe I missed something.

While the functionality is being debugged in the terminal, as soon as it is ready, support in the tester will be switched on.

They will have to support remote testing as well.

Thanks! :( I'll be looking forward to it... I really want to try it already.
 

I decided to write an EA. When I start to write something from scratch, I always check each step for errors, and check the code for efficiency. I did not like the way the Expert Advisor worked with such thing as "new bar" event. I searched long and hard to find the reason - I only got to the bottom of it when the code contains only lines

//+------------------------------------------------------------------+
//| Expert tick function|
//+------------------------------------------------------------------+
void OnTick()
{
Alert("New tick",TimeCurrent());
}
//+------------------------------------------------------------------+

As a result I got a 100% simulation quality, 38242987 ticks simulated, but there are wild omissions in tester's log (whole days), I counted only 13259 ticks...
What could be the reason?

Files:
20120408.log  2074 kb
 

Renat, Slava, it is possible to get close to parametrization by (easy) making apreprocessor special directive that works similar to #include, but allows repeated compilations of the same insluder. Example:

#define ArrayType double
#include "ISTemplate.mqh"
#define ArrayType float
#include "ISTemplate.mqh"
#define ArrayType int
#include "ISTemplate.mqh"
#define ArrayType uint
#include "ISTemplate.mqh"
#define ArrayType long
#include "ISTemplate.mqh"
#define ArrayType ulong
#include "ISTemplate.mqh"
#define ArrayType short
#include "ISTemplate.mqh"
#define ArrayType ushort
#include "ISTemplate.mqh"
#define ArrayType char
#include "ISTemplate.mqh"
#define ArrayType uchar
#include "ISTemplate.mqh"
#define ArrayType string
#include "ISTemplate.mqh"

Right now it compiles but doesn't work (or rather only works for the first #include). A special-directive (#reinclude, #Include or #template) could solve the problem. By the way, it would save you a lot of time too, when writing function overloads for standard types.And the standard library could become compact and nice-looking. And you may come close to "normal" parametrizable classes - just add a new syntax to the language and automate the hidden #reinclude.

// working example, where this inclusion is deployed by my own preprocessor here.

Files:
ISort.mqh  2 kb
 

This is also a variant of class parameterization.

#define _MyContainer(name,type,size) class name {public: type array[size]; virtual type At(int i){return array[i];}}
#define  ASize 8
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   _MyContainer(MyClass,int,ASize);
   MyClass MyVar;
   Print(sizeof(MyVar)); 
   for(int i=0;i<ASize;i++)
     {
      MyVar.array[i]=i*i;
     }
   for(int i=0;i<ASize;i++)
     {
      Print(MyVar.At(i));
     }
  }

It works. You can even add inheritance. ;)

But in order to be able to use this option more or less reliably, you have to at least move lines in macros.

// And this gimmick (when you are not used to it?) looks rather weird. :))

Files:
DefTest.mq5  2 kb
 
MetaDriver:

Renat, Slava, you can get close to parameterization by (easy) making apreprocessor special directive that works similar to #include, but allows repeated compilations of the same insluder. Example:

The idea is clear, but it's better to implement templates right away.

We'll come back to this later.

 
Renat:

The idea is clear, but it is better to implement the templates right away.

We'll come back to this later.

Yay!!! Thank you.
 

This entry in the tester passes with flying colours, Attempting to attach the EA to the graph gives an error.

int OnInit()
  {
   hPerCros=iCustom(_Symbol,0,"\\Каналы\PercentageCrossoverChannel",Percent,Shift) ;
   if( hPerCros < 0)
      Print("Ошибка создания индикатора=  ",GetLastError());
   return(0);
  }
Reason: