Canvas is cool! - page 21

 
Nikolai Semko:

Yes, there was a little snag. Fixed it.

Thank you. (chuckles)

Please, did you re-do the last file?

Oh I see, yes, it's all good now!
 
Nikolai Semko:

To illustrate the speed...

Changing two parameters via the mouse pointer

X - maximum MA period changes

Y - step of МА period changing


Nikolay, just for the sake of interest: What is the point of such indicators? I understand that it's an example, I understand that it's not for trading, but ... The indicator should allow receiving its data from the outside. Otherwise it is just a beautiful image. And the area of application of indicators without receiving their data is greatly narrowed.

A hint of creating methods of giving back data from such indicators would be more interesting.

 
Artyom Trishkin:

Nikolay, just for the sake of interest: what is the point of such indicators? I understand that it is an example, I understand that it is not for trading, but ... The indicator should allow to receive its data from the outside. Otherwise it is just a beautiful image. And the area of application of indicators without receiving their data is very narrow.

A hint on the creation of methods of giving data from such indicators - that would be more interesting.

There is a big problem to find the ways of sending data from the "kanvas" indicators. I see a lot of variants.

Moreover, 99.9 percent of real trading requires only the values of the zero and the first bar. Is it really a problem to pass these values? What is the problem with putting indicator data into an array or a buffer? Resources are also available.

This example was demonstrated with one purpose: - To show that the implementation of indicators through canvas is fast, much faster than classical methods. And it is an absolute flexibility.

Moreover, the big question is: "Do I really need to take data from the indicator?

If I have my own unique indicator, I need the indicator only for visualization. What is the point of calculating the indicator values for the bars outside the window? I think it is absolutely unnecessary. But if I need the indicator values for algotrading, would it not be easier to integrate indicator calculation in the body of an owl through an instance of a class.

 
Nikolai Semko:

Setting up ways of giving data from "canva" indicators is not a big problem. I can see plenty of options.

Moreover, for real trading in 99.9% of cases only zero and first bar values are needed. Is it really a problem to pass these values? What is the problem with putting indicator data into an array or a buffer? Resources are also available.

This example was demonstrated with one purpose: - To show that the implementation of indicators through canvas is fast, much faster than classical methods. And it is an absolute flexibility.

Moreover, the big question is: "Do I really need to take data from the indicator?

If I have my own unique indicator, I need the indicator only for visualization. What is the point of calculating the indicator values for the bars outside the window? I think it is absolutely unnecessary. But if I need the indicator values for algotrading, would it not be easier to integrate the indicator calculation in the body of the owl?

I agree. But there is a category of users who need it in a different way.

But what if the canva indicator returns more than 512 data? The buffers will not help in this case. And users just want to get indicator data in their programs. And they don't want to embed them in the body of the Expert Advisor (I will spare an owl - let it fly without rattles in ...). And they want to receive data on any bar requested, not only on the visible ones. And this is justified. And it is justified not only by laziness and desire to get everything easy and simple, but also by the requirements of TS.

 
Artyom Trishkin:

I agree. But there is a category of users who need it differently.

What if the data returned by the canvas indicator exceeds 512? The buffers will not help in this case. And users just want to get indicator data in their programs. And they don't want to embed them in the body of the Expert Advisor (I will spare an owl - let it fly without rattles in the ...). And they want to receive data on any bar requested, not only on the visible ones. And this is justified. And it is justified not only by laziness and desire to get everything easy and simple, but also by the requirements of TS.

If we are talking about the vast majority of users who are not programmers, they need either the owl or the indicator. They don't need an indicator for the owl.

I just gave some information to think about, I am not imposing anything. Let programmers decide for themselves what is convenient and what is not. However, I personally doubt that I will use iCustom function in my EAs.

 
Nikolai Semko:

Setting up ways of giving data from "canva" indicators is not a big problem. I can see plenty of options.

Moreover, for real trading in 99.9% of cases only zero and first bar values are needed. Is it really a problem to pass these values? What is the problem with putting indicator data into an array or a buffer? Resources are also available.

This example was demonstrated with one purpose: - To show that the implementation of indicators through canvas is fast, much faster than classical methods. And it is an absolute flexibility.

Moreover, the big question is: "Do I really need to take data from the indicator?

If I have my own unique indicator, I need the indicator only for visualization. What is the point of calculating the indicator values for the bars outside the window? I find it absolutely unnecessary. If I need the indicator values for algotrading, is it not so simple to integrate indicator calculation in the body of the owl through the instance of the class?

In my opinion, indicators should also be written through an instance of the class. Then it will be possible to make an indicator or an Expert Advisor by referring to this class. I have one such class in my collection. I liked it very much.

 
Nikolai Semko:

To illustrate the speed...

Changing two parameters via the mouse pointer

X - maximum MA period changes

Y - step of period of MA


Well done, Nikolay. Way to go.

 
Alexey Viktorov:

In my opinion, indicators should also be written through an instance of the class. Then it will be possible to make an indicator or an Expert Advisor by referring to this class. I have one such class in my collection. I liked it very much.

I agree.
 
By the way, another nice bonus of using canva indicators is the fact that the code is almost cross-platform.
 
Реter Konow:

Well done, Nikolai. Way to go.

Note, Peter, how I have implemented a multigradient of 6 colours.

uint Grad(double p)
  {
   static uint Col[6]={0xFFFF0000,0xFFFF00FF,0xFF0000FF,0xFF00FFFF,0xFF00FF00,0xFFFFFF00};
   p=p*5;
   int n=(int)p;
   if(n==5) return Col[5];
   double k=1-p+(int)p;
   argb c1,c2;
   c1.clr=Col[n];
   c2.clr=Col[n+1];
   return ARGB(255,c2.c[0]+uchar(k*((int)c1.c[0]-(int)c2.c[0])+0.5),
               c2.c[1]+uchar(k*((int)c1.c[1]-(int)c2.c[1])+0.5),
               c2.c[2]+uchar(k*((int)c1.c[2]-(int)c2.c[2])+0.5));
  }

Where p changes from 0 to 1.

ZS But there's one problem with the outermost colour, which I haven't got around to fixing yet.

Reason: