Machine learning in trading: theory, models, practice and algo-trading - page 146

 
mytarmailS:

I'm not a forex trader, I'm not even familiar with Metatrader :)

I would like to experiment with the profile in its different types in the R-ka, I just do not understand how to make a distribution of two vectors

I would like to experiment with different variants of profile, I just don't understand the distribution with two vectors, it's not necessary the volumes, it's just a start, you can put to the profile anything you like but it should be related to the price and that means two vectors

Then what are you doing on this forum? A forum that is entirely devoted to MetaTrader? It's already been said before - there will be no direct access (API) from outside into the MetaTrader ecosystem.
 
Karputov Vladimir:
Then what are you doing in this forum? A forum that is devoted entirely to the MetaTrader terminal? You've already said before that there will be no direct access (API) to the MetaTrader ecosystem from the outside.

Read the title of this thread and tell me how Metatrader figures here?

And what is the point of this discussion?

 
mytarmailS:

Read the title of this thread and tell me how Metatrader figures here?

And what is the point of this discussion?

The terminal comes with new math libraries, such as these:(Discussing the article "Statistical Distributions in MQL5 - Using the Best of R") - so why don't you post examples for MetaTrader?
 
Karputov Vladimir:
New mathematical libraries appeared in the terminal's delivery, such as these:(Discussing the article "Statistical Distributions in MQL5 - Using the Best of R") - so why not publish examples for MetaTrader?

Because I'm not very good at it :) I'm not familiar with MQL

Even I (who's not a programmer) understand that there's nothing you can do with built-in functions, you have to write everything yourself... What you translated a dozen of statistical functions from R is certainly good and even commendable, but this is not even a drop in the ocean compared to the capabilitiesof R, it is constantly evolving, new libraries appear every day, not functions but libraries, how can you keep up with this?

 
mytarmailS:

Because I'm not very good at it :) I'm not familiar with MQL

Even I (who's not a programmer) understand that no built-in functions are enough here, you have to write everything yourself... The fact that you translated a dozen statistical functions from R is certainly good and even commendable, but understand that this is not even a drop in the ocean compared to the capabilities of R, it is constantly evolving, every day there are new libraries, not functions but libraries, how can you keep up with this?

You don't know MQL language, you don't know terminal, how can you judge about something in general?

PS. It's a pity, but there are so many users on this forum who are parasitizing on MT ecosystem. But it also shows the great popularity and sophistication of the platform, which attracts the smartest people to research in MQL, and, of course, attracts parasites, how could it be without them...

 

Let's stop talking about nothing, everyone has his own opinion, and this thread has a specific topic...

So what's up with that distribution? can it be built by two vectors or not? :)

 
mytarmailS:

So what's up with that distribution? Can it be plotted using two vectors or not? :)


Here's a good article:https://www.r-bloggers.com/5-ways-to-do-2d-histograms-in-r/

x <- rnorm(mean=1.5, 5000)
y <- rnorm(mean=1.6, 5000)
df <- data.frame(x,y)
library(gplots)
h2 <- hist2d(df, nbins=10) #сторона  квадрата = 10
h2$counts
 

Here is a more vivid example. In the archive - RData with eurusd h1 from 2012 to today.

MetaQotes-Demo provides both tick volumes and trading volumes, but I don't know how much I can trust them.

load("H1.RData")
library(gplots)
#торговые  обёмы и цены закрытия за последний год
hist2d(x = H1[(nrow(H1) - 6225):nrow(H1), c("Close", "Trade.volume")], nbins = 100)


Files:
H1.zip  671 kb
 

Thank you! I got a similar thing in my trailer...

x <- D$X.CLOSE.[1:2000]
y <- D$X.VOL.[1:2000]
df <- data.frame(x,y)
library(gplots)
h2 <- hist2d(df, nbins=100) #сторона  квадрата = 10
#h2$counts

qq


I just don't know how to interpret thish2$counts matrix, there's so much stuff there, it's creepy...

I would like to get something similar to a normal distribution, like withhist() remember? It would be similar to the volume profile, or, better yet, one-to-one, is it possible to do it with R-ki tools?

I've got something at https://futures.io/matlab-r-project-python/29465-r-volume-profile-volume-price.html, I'll look into it

 
mytarmailS:

I would like to get something similar to a normal distribution, like withhist() remember? It would be similar to volume profile, and better it would be exactly the same, is it possible to do it with P-key tools?

If you take only one vector, the price, the histogram will show the number of repetitions of each price level. There will be bars growing out of the line, to put it simply.

If we take two vectors - price and volume, then price will have its own levels, and volume will have its own levels. These are two different dimensions that form a plane. From the plane, histogram bars will grow up, showing the number of repeats for each combination of price and volume.
hist2d shows the height of the bars in color instead of drawing three-dimensional bars. A nicer version on the same data would look something like this:


To draw a simple histogram as in hist() for price and volume, you must first bring two vectors (price and volume) to a single vector by some formula and draw a histogram for it. You must decide what kind of new vector this is, what you want from it, and where to get it. Roughly speaking, you want to get a flat histogram from that three-dimensional picture above, which can be done in an infinite number of ways.

The h2$counts is the matrix representation of that histogram. Take nbins=5 for example to make the histogram 5x5 for clarity and look at h2$counts - that too will be a 5x5 matrix. The brighter the histogram cell, the higher the number will be in the matrix in the corresponding cell.

Finished this later.
Found a way to make it look nice.

library(plot3D)
levels_count <- 20
volume_levels = cut(H1[(nrow(H1) - 6225):nrow(H1), "Trade.volume"], levels_count)
price_levels = cut(H1[(nrow(H1) - 6225):nrow(H1), "Close"], levels_count)
h3d = hist3D(z = table(volume_levels, price_levels), xlab="volume", ylab="price", zlab="frequency", border="black")



Reason: