bahsettiğim şey bu...
![]()
burada hatam nedir
Üssel ortalamanın,normal açık formulunden kaynaklı hata...
Bak basit ortalamada o hata yok.Basit ortalamaya kendim açık formul yazdım...
Üssel e bir bar önceki degeri kullanmak zorunda oldugundan,daha çözüm bulamadım...
İyileştirme var ama tam sonuç daha yok...
Data sayısına oranla yüksek peryotlu ortalamada hata kaçınılmaz oluyor....
sayın uufuk ema için linkteki dökümanda sizinkinden biraz farklı bir yaklaşım var, aradığınıza çözüm olabilir mi diye paylaşıyorum.
Step 2: The Logic
Start with the initial values that will not change. The time interval is fixed but assigned to a variable. Alpha is also fixed but still needs to be calculated:
tp:= 40; {EMA time periods}
alpha:= 2 / (tp +1);
Next, the formula to identify the start of a new time period should be done. This is best near the top so it is easily changed allowing the basic logic of a formula to be reused with just minor 78changes. The formula for an hourly extrapolation will look for
a change in the value of the Hour() function. Since the 5 minute interval is where the formula will be applied and 5 minutes is evenly divisible into 60 minutes, this extrapolation is possible. The same logic for a daily extrapolation can be used. Just change the DayOfWeek() function to the Hour() function:
new:=ROC(Hour(),1,$)<>0;
This identifies when a new hour starts. However, the average needs to use the Close of the previous hour for the calculation. So, each time new is true, the Ref() function is used to get the previous bar’s close for the new value in the average. If new is not
true, use PREV to “remember†the last value of the average. This same PREV is used for the value of the average from the previous interval to calculate the next of the average:
EMA:= If( new, ( Ref(C, -1) * alpha) + ( PREV * (1-alpha)), PREV);
However, this calculation does not seed the average with the close of the first hour in the chart. PREV has the value of zero at the start of the chart. This means the value of EMA will start at zero and slowly increase over the next several hours before it
gets to a value close to what the prices are. Typically, this would take one to two times the length of the average. To avoid that, the average can be assigned a value to start with. This seed value will then be used by PREV as a jump-start, instead of the value of zero.To seed the average, another If() must be combined with the first. When new is true, this If() is checked first and can only be true on the first hour of the chart. The Cum() function can be used to count the number of times new has been TRUE:
EMA:= If
( new, If( Cum( new ) = 1, Ref(C, -1),
( Ref(C, -1) * alpha) + ( PREV * (1-alpha))), PREV);
Step 3: The Final FormulaNow all that remains is to call the EMA variable so the formula will plot the value. The final formula should look something like this:
tp:= 40; {EMA time periods}
new:=ROC(Hour(),1,$)<>0;
alpha:= 2 / (tp +1);
EMA:=
If
( new, If( Cum( new ) = 1, Ref(C, -1),
( Ref(C, -1) * alpha) + ( PREV * (1-alpha)), PREV));
EMA
bu ilgili dökümanın linki sayfa 80
https://www.metastock.com/customer/r..._Primer_II.pdf
matriks için denemedim çalışır mı fikrim yoktur. saygılar
Selamlar arkadaşlar...
üstte sormuş olduğum sorular bir yana, Sayın ufuk beyin;
yardımcı olmaya çalışması vs herşey güzelde
elimde sıfır öyle çaresizce duruyorum.
Canı saolsun Ufuk bey özelden birşeyler yazdı ama olmadı olamadı...
kod bilgisine sahip biriyim ama
söz konusu mtf olunca yapamıyoruz...birazda matriks bu konuda geride...
Ufuk bey özel yerine buradan yazmamızı istediği için genele yazıyorum.
ben derdimi tekrar izah edeyim belki yardımcı olmak isteyen olur kimbilir.
5dk grafik üzerine ;
15dk 1440 ema yada sma
60dk 1440 ema yada sma
çizdirmek istiyorum.
bunun için;
Nw:=HOUR()<>ref(HOUR(),-1);
n1:=1440;
p1:=2/(n1+1);
x1:=If(nw,(p1*Ref(C,-1))+((1-p1)*PREV),PREV);
x1
ve SMA içinde
nw:=HOUR()<>ref(HOUR(),-1);
n1:=1440;
p1:=1/(n1);
nc1:=valuewhen(n1+1,nw,Ref(C,-1));
x1:=if(nw,(p1*Ref(C,-1))+(PREV-nc1*p1),PREV);
x1
kullanmaya çalıştım. (formüller ufuk beyin paylaşımıdır.)
ama bu değerde çizimi net değerlerle alamıyorum.
normalde 5 -15 60 lıklarda 1440 ema veya sma çizdirilirken mtf olarak olmuyor.
bunun bir çözümü yokmudur...
Yer İmleri