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

 
Forester #:

Restore and share the code for reproduction by any forum member.

SMA increment = price difference for the period divided by the period

SMA[0]-SMA[1]=(Price[0]-Price[Period_SMA])/Period_SMA

the average value of SMA for a long period tends to the average value of prices.

In the realities of price fluctuations, 4-5 periods of accuracy is enough to calculate prices from SMA. For non-periodic or with great claims to accuracy, more is needed

 
library(runner)
library(TTR)

y <- rnorm(500) |> cumsum() 

X <- y |> 
     SMA(30) |> 
     runner(f = c, k = 10,na_pad = T) |>
     do.call(what=rbind) |> 
     cbind.data.frame(Y=y)

pr <- lm(Y~.,X[100:300,]) |> 
       predict(X[,-ncol(X)])


plot(y,t="l")
lines(pr, col=2)
abline(v=300, lty=2, col=8)



you can't recover lost information from lost information.

 
Maxim Kuznetsov #:

SMA[0]-SMA[1]=(Price[0]-Price[Period_SMA])/Period_SMA

Correct me, but you are using price in the price recovery formula.... prices.

Or I don't get it.



UPD

We have values already smoothed. We don't know the prices that were used. And we need to reconstruct them.
 
mytarmailS #:



you can't recover lost information from lost information.

Show me where the information was lost.

just like the parrots: information lost, про@#4лась..ГДЕ ? point the finger at the place of loss.

 
Maxim Kuznetsov #:

show me where the information was lost.

just like the parrots: information lost, про@#4лась..ГДЕ ? point the finger where it was lost.

Are you sick or something? I've told you 10 times already!


Mashka filter you filter all the high frequencies, you throw them away, it's obvious!!! Wake up!!!


it's obvious to everyone.

Ivan Butko #:

Wehave values already smoothed.We don't know the values that were used. And we need to restore them .

 
Maxim Kuznetsov #:

show me where the information was lost.

just like the parrots: information lost, про@#4лась..ГДЕ ? point the finger where it was lost.

- 5 and 5, -6 and 6, -7 and 7, -8 and 8 give an average of 0.

How to restore prices from zero without peeking into history in the formula?

 
mytarmailS #:

Mashka, you're filtering out all the high frequencies.

By the way, yes, the maximum and minimum values - they are the first to fly into oblivion.

 
Maxim Kuznetsov #:

show me where the information was lost.

I think you have confused the concept of recovery with the concept of backtracking

 
Ivan Butko #:

Correct me, but you are using... in the price recovery formula. prices.

Or I don't get it.



UPD

We have the values already smoothed. We don't know the prices that were used. And we need to reconstruct them.

We don't know the prices, but we know the average for N bars (N>> SMA period), which is surprisingly equal to the average of MA values.

We can take anything as price 0 (e.g. 1.0 or SMA "on the bend"), build a "similar" curve from 1.0 by increments, then scale and position it.

In the general case, SMA requires a large number of bars (at first glance, it is a period squared in half, somewhere like that). But we do not have a general case - here we have strict ranges and periodicity from nature.

And with large periods - SMA is close to sine-weighted (monotonic ma-mas are interchangeable), which again Fourier and inverse methods are known there

 
Ivan Butko #:

- 5 and 5, -6 and 6, -7 and 7, -8 and 8 give an average of 0.

How do you reconstruct prices from zero without peeking at history in the formula?

you are slightly confusing average and moving average.

from the moving average you can get the original, the accuracy will depend on the duration of the fixed "sliding".

you cannot get an average from a one-stage average, alas :-)