10$ for upgrading the indicator - page 3

 
Svinozavr >>:
Алексей, а чем тебя предложенный мной расчет не устраивает? Тебе индикатор написать, чтоб пояснить? )))

you are shifting incorrectly. take a period of 3.33333 for example.

 
Can I do that?

   for(int i=limit; i>=0; i--)
   {
      MA[i]=(iMA(NULL,0,MathCeil(DMA),0,0,PRICE_CLOSE,i)-iMA(NULL,0,MathFloor(DMA),0,0,PRICE_CLOSE,i))*(DMA-MathFloor(DMA))+ iMA(NULL,0,MathFloor(DMA),0,0,PRICE_CLOSE,i);
   }
 
avatara >>:

вы сдвигаете неверно. возьмите период 3.33333 например.


??? I don't shift anything at all. And if you write it in Integer form, instead of the usual FIR form, it works like this:

(0.33333*Close[3] + Close[2] + Close[1] + Close[0])/3.33333

 
Svinozavr >>:

??? Я вообще ничего не сдвигаю.

back. We do not only count the 0 value of the indicator buffer, but also N-1 of the others.
I propose to evaluate correctness of formula for other indexes

 
Svinozavr >>:
Алексей, а чем тебя предложенный мной расчет не устраивает? Тебе индикатор написать, чтоб пояснить? )))

You don't need an indicator, the formula is enough. Your formula is asymmetric in prices, that's what bothers me.

For example, for a period of 3.5 SMA can be written as follows:
a1*Close[3] + a2*Close[2] + a2*Close[1] + a2*Close[0], where a2=1/3.5, a1=1-3/3.5;

By the way, there's something wrong with your formula. You probably meant a2=1/3.5, a1=0.5/3.5 ? And why exactly is a1 so special and not some other? Why not suggest the other way around, by making the k-value at Close[0] smaller?

Well, you probably know what a gamma function is. It is a natural continuation of the factorial into the non-integer region. This continuation does not violate any properties of the factorial of integers and is simultaneously "smoothest" in some sense (there was something about convexity, I do not remember, it was studied long ago).

In principle, the guy probably wanted even the slightest change in period (non-integer) to somehow be reflected in the muve. But it can be done in a thousand ways.

2 avatara: Well the same situation. Your version I like better actually. But there's a problem here too: the contribution of extreme points differs from that of the rest. It's not a property of a simple wand.

Perhaps I'm being too categorical. It's best when you have an example in front of you - say, in Easy Language. You can already see the algorhythm there.

 
Mathemat >>:
Лучше всего, когда видишь перед собой пример - скажем, на Easy Language.

I gave a hint. /* as it seems to me - you need to solve the geometric problem with a shift. then at 0 index Peter's formula is correct. And then change the marginal coefficients. */

------

It's a mini test provocation ;)

 
How about this formula

For example, for a period of 3.3333333 SMA can be written as
iMA(...,3.3333333,...)=a1*iMa(...,3,...)+a2*iMa(...,4,...). where a1+a2=1. a1=0.666666, a2=1-a1=0.3333333. And if we put 0 and 1 into formula, that's what we get.
 
grell >>:
Как вам такая формула

Например, для периода 3.3333333 SMA можно записать так:
iMA(...,3.5,...)=a1*iMa(...,3,...)+a2*iMa(...,4,...). где а1+а2=1. а1=0.6666666, а2=1-а1=0.3333333. И если в формулу подставить 0 и 1, то то на то и выйдет.

+5)

 
In my opinion, a most elegant solution. grell, bravo!
Straightforward formula:
2/3*(C0+C1+C2)/3 + 1/3*(C0+C1+C2+C3)/4 = (2/9+1/12)*C0+(2/9+1/12)*C1+(2/9+1/12)*C2+1/12*C3= 11/36*(C0+C1+C2)+1/12*C3
Yes, the k's are asymmetrical anyway. But it's beautiful!
 
Thank you, the solution came just from the individual cases.