Possibilities of Canvas. - page 3

 

Forum on trading, automated trading systems and testing trading strategies

Canvas is cool!

Aleksey Ivanov , March 3, 2009 9:55

If you drink a strong "kvass" - the world plunges into canvas. :)


I propose an idea for the practical application of canvas and this is a completely new direction.

In the figure is a fractal. It can be based on quotation histories (sliding windows) to calculate their fractal structures and translate them into similar graphic images, by the form of which you can already identify market conditions. Get a kind of indicator. For example, in physics (solids), the Fermi surface is judged on the state of the material; it is also possible to judge from the fractal patterns on the market condition, since as the empirical material accumulates, the language of image correspondence to specific market conditions will be formed.

 

Forum on trading, automated trading systems and testing trading strategies

Indicators: MaFromMa

This indicator was created to demonstrate indicator recursion, when the indicator is calculated from itself any number of times.recursion,

for ( int i = 0 ; i <N; i ++) handle = iMA ( _Symbol , _Period , per2, 0 , MaMethod, handle );

In this variant, Moving Avarage with a period of Per2 from another Moving Avarage with a period of Per1 is calculated for any number of repetitions N.Avarage


 

Code Base

The system of linear algebraic equations on each bar

Nikolai Semko , 2019.05.02 09:00

Indicator for two windows on the example of solving a system of linear algebraic equations of any

 

https://www.mql5.com/ru/code/25929


The formation time of the entire image (calculation is about 1000 MA and outputting them to the screen) is about 15-25 milliseconds.

 

Forum on trading, automated trading systems and testing trading strategies

Colored candles (wishes)

Nikolai Semko , 2019.03.02 14:28

I still spent a couple of hours for a demonstration of replacing the indicator with banded candles so as not to be unfounded.

I even exaggerated at the expense of 30-50 lines of code. The main function ShowBars, which forms the candles on the screen only 9 lines of code:

 void ShowBars( bool change= true )
  {
   static MqlRates B[];
   uint clrBody= 0 ;
   if (change) CopyRates ( _Symbol , _Period ,( int )W.Right_bar,W.BarsInWind,B); else B[ ArraySize (B)- 1 ]=Bar0;
   Canvas.Erase(W.Color);
   for ( int i= 0 ,x=- 1 ; i<W.BarsInWind;i++,x+=W.dx_pix) 
     {
      Canvas.LineVertical(x,( int )(Canvas.Y(B[i].high)- 0.5 ),( int )(Canvas.Y(B[i].low)- 0.5 ),clrLine);
       if (B[i].close>B[i].open) clrBody=clrBull; else if (B[i].close<B[i].open) clrBody=clrBear; else clrBody=clrLine;
      Canvas.FillRectangle(x- int (W.dx_pix* 0.35 ),( int )(Canvas.Y(B[i].open)- 0.5 ),x+ int (W.dx_pix* 0.35 ),( int )(Canvas.Y(B[i].close)- 0.5 ),clrBody);
     }
   Canvas.Update();
  }

It is expensive?

Of course, this code is only demonstration, but still quite working. And "control the width, height of the window, the scale of the display of the graph , rewind, offset" performs.



Files:
CanvasBar.mq5  7 kb
 
The first experiments with a dynamic timeframe.

EURUSD the whole story in dynamics:



Fractality is evident!

 

Do not judge strictly. Only the first drafts of a dynamic timeframe.

For the best work, you need to set the number of max bars in the chart - Unlimited!


Files:
DinTF.mq5  13 kb
iCanvas.mqh  21 kb
 

The beauty of canvas is that you can easily write indicators with any number of lines without increasing the size of the program, simply generating them in a loop, and also decorate these lines as you wish.

Moreover, the code will be the same for mql4 and mql5.


 
Price in polar coordinate system
Price in polar coordinate system
  • www.mql5.com
I want to remind you that for you to see the maximum data history on the screen, you need to set unlimited in the settings "Max bar in chart"(Tools ->Options->Charts). The position of the mouse changes the parameters of the polar coordinate system: Changes in the start date of data output are set using the mouse position on the X axis...