The function of decomposing color into shades. - page 6

 

Back to talking about the colour decomposition algorithm. I apologise for the off-topic.

If anyone has questions about how and where to apply the algorithm, they can find explanations on the previous pages.

 
Vladislav Andruschenko:

Can I put in my "10 kopeks" about the GUI and everything that is being discussed here.

Everyone has a dream, a hobby, a passion.

Some go fishing, some like photography, some like travelling, some like modelling aeroplanes....


And so it is here:

MetaTrader developers have made a good step in popularizing the MQL5 language!

All the posts about the lack of patterns or structures are needed by those who use it.


The same creation of GUI libraries, for example by Anatoly, is his hobby. He did it and showed it to everyone.

I watched and wondered... and in the beginning of what he started to "do" with his library - I've had plans to "make a GUI" for a long time , But I chickened out.

And then I didn't "catch up" with someone who did it very hard.

He made this library and I'm sure many people use it.

For him it was a hobby, a favourite thing to do. He was only engaged in this project (probably) and was sick of it. And he's sick of it now.


For Peter he also has his hobby. Peter makes his own GUI.

And everyone will insist on his/her own.

Some need it, some don't.


Why prove anything? Change your mind? Trying to be "helpful"? BECOME THEM, not try to.


Some people need GUI in EAs, others do not.

Somebody draws games in MQL, and someone doesn't need any parameters in an EA.

Everyone is so different that there is no point in persuading anyone of something.

Let everyone has their own point of view and mind their own business. Then there will be no conflicts.


We all started somewhere. We all learned something from each other. Why everyone used to be friendlier?

Vladislav. I am driven by a desire to understand my difference with people. Why me and them have such different views. That's all.

Some people see it as advertising their product, others as a fixation, others as a fix-idea and so on.

But in fact - I argue and prove, because I want to understand others and myself.

 
Реter Konow:

Vladislav. I am driven by a desire to understand my difference with people. Why me and them have such different views. That's all.

Some people see it as an advertisement for their product, others as a fixation, others as a fix-idea and so on.

But in fact - I argue and prove, because I want to understand others and myself.

I assure you, there is: OOP and procedural programming.

Wherever OOP is needed - OOP is used.

Where OOP is needed, a simple type of programming - procedural programming - is used.

There are as many people as there are opinions.

If you go to an IT firm and tell them that you program in PP, they will send you away.

Here you do what you want to do.


As soon as you start writing tutorials on your GUI, you will build "your" army of fans. There will also be an army of trolls, but that's a must too :-)

Let them argue between themselves what is better. GUI on OOP or GUI on PP.


Just trust me.

Do what you like and there will be those who will use it.
Don't argue, don't get into conflicts. A lot of effort is wasted on this, it is better to channel all your power into your project!

 
Vladislav Andruschenko:

I assure you, there is: OOP and procedural programming.

Where OOP is needed, OOP is used.

Where OOP is needed, a simple type of programming - procedural programming - is used.

There are as many people as there are opinions.

If you go to an IT firm and tell them that you program in PP, they will send you away.

Here you do what you want to do.


As soon as you start writing tutorials on your GUI, you will build "your" army of fans. There will also be an army of trolls, but that's a must too :-)

Let them argue between themselves what is better. GUI on OOP or GUI on PP.


Just trust me on this one.

Do what you like and there will be those who will use it.
Don't argue, don't conflict. A lot of energy is spent on this, it is better to channel all of it into your project!

Okay. I agree with you.

And what do you think of my algorithm?

How convenient and useful is it in your opinion?

 
Реter Konow:

Good. I agree with you.

What do you think of my algorithm?

How convenient and useful is it in your opinion?


I, as a supporter of "easy and simple", prefer your version.

But I, like many others, adhere to the idea that OOP is mandatory.

Because of my specific job, I know that "customer", for example, needs a clear code, even with Russian names of variables. Russian customers in general are crazy about it.

And since they "order" a program it means they don't understand anything and they need a lighter code. With russian variable names.......


But I realized long ago that custom programming drags you down! There is no self-development. Now it is more interesting to make your own projects without showing the code. Where you can already use OOP.

And in general the user needs a simple constructor, where there are elements and they can be managed directly on the graphics.


Again. Every solution has its own army of fans.

Just do what you like...


this is all from experience, so I'm not claiming to be correct, what I've said....

I read all the threads in general discussion, (all because I'm too lazy to browse below that section :-) ) and am amazed.

Sometimes I want to insert "my 12 cents", but to prove something to someone takes away energy.

From the same vein - the discussion of "what you need in the market" - everyone needs something different.

Someone needs a full automatic with one RISK parameter, and someone needs 100500 parameters!

It is better to have one project and develop it to the point of exhaustion and only then take on the next one.

Than, changing the name of the program and the image from the tester, multiply hundreds and thousands of projects which nobody needs....


IMHO

Respect to all!!!

 

Thank you for your feedback. Glad you liked it. I'd be happy if you could use this algorithm in your developments.

Just got a little off-topic here. That's my fault. It was the algorithm we were talking about. The rest of the topics can be ignored.
 
Vladislav Andruschenko:


I, as a supporter of "easy and simple", like your version better.

But I, like many others, stick to the idea that OOP is mandatory.

Because of my work, I know that "customer", for example, needs clear code, even with Russian names of variables. Russian customers in general are crazy about it.

And since they "order" a program it means they don't understand anything and they need a lighter code. With Russian variable names.......

...

In my practice, no one has ever got stuck, except for 3 people on this forum.

I, for example, vomit from such code, I read it no more than 3 lines, and delete it.

 
Vitaly Muzichenko:

In my practice, no one has ever been dragged away, except for 3 people on this forum.

I, for example, am sick of such code, I do not read more than 3 lines and delete it.

You, as an English speaker, feel free to ignore my decision. There are few English words there.

By the way, since you are so good at English code, please help me to parse the code suggested by Nikolay Semko:

#include <Canvas\iCanvas.mqh> //https://www.mql5.com/ru/code/22164

union rgb {uint clr; uchar c[4];};

void OnStart()
  {
   rgb c,cc;
   double d=5;
   while(!IsStopped())
     {
      c.c[2]=uchar(127.5*(1+sin(d*1.2))+0.4999); c.c[1]=uchar(127.5*(1+sin(d*1.9))+0.4999); c.c[0]=uchar(127.5*(1+sin(d*2.8))+0.4999);  // генерируем новый цвет
      cc.clr=c.clr;
      double k0,k1,k2;
      if(c.c[2]>=c.c[1] && c.c[2]>=c.c[0]) {k2=1; if(c.c[2]==0) {k1=1; k0=1;} else {k1=(double)c.c[1]/c.c[2]; k0=(double)c.c[0]/c.c[2];}}// если Red - максимальный цвет
      else if(c.c[1]>=c.c[2] && c.c[1]>=c.c[0]) {k1=1; k2=(double)c.c[2]/c.c[1]; k0=(double)c.c[0]/c.c[1];} // если Green - максимальный цвет
      else {k0=1; k2=(double)c.c[2]/c.c[0]; k1=(double)c.c[1]/c.c[0];} // если Blue - максимальный цвет
      for(int y=0; y<W.Height; y++)
        {
         double k=255.0*(double)y/(W.Height-1);
         c.c[2]=uchar(k2*k+0.4999);
         c.c[1]=uchar(k1*k+0.4999);
         c.c[0]=uchar(k0*k+0.4999);
         Canvas.LineHorizontal(0,W.Width-1,y,ColorToARGB(c.clr,240));
        }
      Canvas.FillRectangle(W.Width/2-80,W.Height/2-50,W.Width/2+80,W.Height/2+50,ColorToARGB(cc.clr,240));
      Canvas.CurentFont("Tahoma",20,22,ColorToARGB(~cc.clr)); // 20 -  размер шрифта, 22 - межстрочный интервал
      Canvas.TextPosition(W.Width/2-70,W.Height/2-40);
      Canvas.Comm("Текущий цвет:");
      Canvas.Comm("R = "+string(cc.c[2]));
      Canvas.Comm("G = "+string(cc.c[1]));
      Canvas.Comm("B = "+string(cc.c[0]));
      ChartChanged(); // на всякий случай контролируем изменение размеров окна, т.к. это скрипт (в индикаторах и экспертах это происходит автоматически)
      Canvas.Update();
      d+=0.01;
      Sleep(30);
     }
  }

Honestly, I don't understand how it works. It has a lot of short English syllables. Just what you like.

 
Vitaly Muzichenko:

In my practice, no one has ever been dragged away, except for 3 people on this forum.

I, for example, get sick of such code, I do not read more than 3 lines, and then delete it.

I completely agree with you.

Variables must be in an international language.


But I'm talking about "customers".

I met some who wanted the variables to be in Russian.

How can I argue with that? The customer "needs".

That's why I gave up orders a year ago, so I don't have to prove anything.


For example you place an order with English names, nobody says anything to you.

And you try to create variables in Russian - he would love it. And he will drag himself away because he does not know English.

 
Реter Konow:

You, as an English speaker, feel free to ignore my decision. There are few English words there.

By the way, since you are so good with English code, please help me with the code proposed by Nikolay Semko:

Honestly, I don't understand how it works. It has a lot of short English syllables. Just what you like.


Well, names in English aren't invented for nothing.

I can give you one more example when Russian names will kill your code:

You pass the code to a customer who does not have Cyrillic. That's it. .... all gone..... :-)


One more point.

For example GOOGLE translator has a native language of English. If you write the title in English, they will be able to translate it with the translator.

Otherwise there will be problems.

Well it's just saying for the future.


For Russians, the language is Russian.

For the rest of us, English is more familiar.

Spanish is also the most popular language.

Reason: