You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You never sleep ????
It's 1:00 AM in France...
Just to be sure too. At the end, the first sum we have nlmprices[r-k]
is it the sum of all price or all price with m as a momentum (can be 1, 2 or more as with a RMI ?
I say that because it strange with my code when I put length>6 the NonLagMa is no more on the candles but below as it is not usual with other MA (Tillson, SSmoother and so on)
Thanks
Zilliq
For example a nonlagma with a lenght of 4: It's ok
But with a length of 9 in blue is far below at the difference for example of a Tillson MA in red who stay on the candles with a lengh of 6 and who is more smoother
It is logical but the NonlagMa seems to be more responsive but less smooth is it right ?
For example a nonlagma with a lenght of 4: It's ok
But with a length of 9 in blue is far below at the difference for example of a Tillson MA in red who stay on the candles with a lengh of 6 and who is more smoother
It is logical but the NonlagMa seems to be more responsive but less smooth is it right ?zilliq
Yes. As a rule of thumb, the more responsive some filter is (unless it is a fitting / recalculating filter) the less smooth it will be
I think I have a problem with my code, because with the length of 1, the NonlagMa is not on the price at the difference of your code
I will seek where is the problem it seems to be on the alfa
See U
Zilliq
I think I have a problem with my code, because with the length of 1, the NonlagMa is not on the price at the difference of your code
I will seek where is the problem it seems to be on the alfa
See U
ZilliqZillq
Length 1 should be equal to price itself (each average must return price itself for length 1)
Hi Mladen,
I hope you're fine,
I think I succeed in coding the Nonlagma
And I see something very curious: Its seems to very similar to a T3 Tillson as you see on my graph (in purple the nonlagma and in blue a T3). Do you ever see that and do you have an explanation ? T3 is smoother and have the same "Nonlag" shift. I thought that Nonlagma will be better.
Perhaps a stupid question but what is for your the "best" MA (T3, Oma, NonlagMa, Hull etc...), who means the best ratio smooth/Nonlag ?
Have a nice night and thanks for your help
Zilliq
Hi Mladen,
I hope you're fine,
I think I succeed in coding the Nonlagma
And I see something very curious: Its seems to very similar to a T3 Tillson as you see on my graph (in purple the nonlagma and in blue a T3). Do you ever see that and do you have an explanation ? T3 is smoother and have the same "Nonlag" shift. I thought that Nonlagma will be better.
Perhaps a stupid question but what is for your the "best" MA (T3, Oma, NonlagMa, Hull etc...), who means the best ratio smooth/Nonlag ?
Have a nice night and thanks for your help
Zilliq
zilliq
Every average, if you compare short periods looks like some another average too (that is why, for example, adaptive averages look like any other average when the period is short - they simply do not have the "room" to show what are they actually like)
Only when the calculation periods are long enough, then you can see the difference. Here is a comparison of a 25 period T3 and nonlag ma - the difference is going to grow and grow as the period grows - orange is non lag ma green is T3
Thanks Mladen,
I understand, and it's very clear on your graph
It's strange because when I use the nonlagma I code on my graph it's not so close of the price as on your graph (blue is T3 purple is Nonlagma) here with a period of 20
I know it isn't the same code language as MT4 but can you confirm the calculation of the alfa that we apply on each price:
*************************************
pi = 3.14159265358979323846264338327950288
Cyclee=4
Coeff = 3*pi
Phase = Length-1
Len = Length*Cyclee + Phase
weight=0
sum=0
for i=0 to Len
if i<=Phase-1 then
t = 1.0*i/(Phase-1)
else
t = 1.0 + (i-Phase+1)*(2.0*Cyclee-1.0)/(Cyclee*Length-1.0)
endif
beta = Cos(pi*t)
g = 1.0/(Coeff*t+1)
if t <= 0.5 then
g = 1
endif
alfa = g * beta
sum=close*alfa
weight=alfa
next
**************************
Because it seems I have a big difference and I don't understand why
After that we add all alfa*price on a period of "Length"
Same thing on alfa, we add all alfa on Length period
****************************
sum1=summation[Length](sum)
weight1=summation[Length](weight)
nonlagma=sum1/weight1
****************************
But I have not the same Nonlagma ???
Do I miss something on the MT4 code ?
Thanks a lot for your help
Zilliq
Thanks Mladen,
I understand, and it's very clear on your graph
It's strange because when I use the nonlagma I code on my graph it's not so close of the price as on your graph (blue is T3 purple is Nonlagma) here with a period of 20
I know it isn't the same code language as MT4 but can you confirm the calculation of the alfa that we apply on each price:
*************************************
pi = 3.14159265358979323846264338327950288
Cyclee=4
Coeff = 3*pi
Phase = Length-1
Len = Length*Cyclee + Phase
weight=0
sum=0
for i=0 to Len
if i<=Phase-1 then
t = 1.0*i/(Phase-1)
else
t = 1.0 + (i-Phase+1)*(2.0*Cyclee-1.0)/(Cyclee*Length-1.0)
endif
beta = Cos(pi*t)
g = 1.0/(Coeff*t+1)
if t <= 0.5 then
g = 1
endif
alfa = g * beta
sum=close*alfa
weight=alfa
next
**************************
Because it seems I have a big difference and I don't understand why
After that we add all alfa*price on a period of "Length"
Same thing on alfa, we add all alfa on Length period
****************************
sum1=summation[Length](sum)
weight1=summation[Length](weight)
nonlagma=sum1/weight1
****************************
But I have not the same Nonlagma ???
Do I miss something on the MT4 code ?
Thanks a lot for your help
Zilliq
How is cosine function working in your platform : is it using radians or degrees for an argument?
Metatrader's cosine is using radians
We use radian too
May be an explanation: In the MT4 code we multiply alfa with price
I suppose this is the price, i périods before, no ?
And so we need to add, for example with a len of 5
alfa*close[4]+alfa*close[3]+alfa*close[2]+alfa*close[1] and alfa*close
or
alfa[4]*close[4]+alfa[3]*close[3]+alfa[2]*close[2]+alfa[1]*close[1] and alfa*close ?
And it's strange, because with a length of 1 the len is equal to 4 (4*1+0) and so the nonlagma can't be equal to close because we add the alfa*price of the last 4 periods
Thanks for your next comments
Zilliq
Is use your code, but to better understand I use the simpliest code of the NonlagMav3
double pi = 3.1415926535;
double Coeff = 3*pi;
int Phase = Length-1;
double Len = Length*Cycle + Phase;
if ( counted_bars > 0 ) limit=Bars-counted_bars;
if ( counted_bars < 0 ) return(0);
if ( counted_bars ==0 ) limit=Bars-Len-1;
for(shift=limit;shift>=0;shift--)
{
Weight=0; Sum=0; t=0;
for (i=0;i<=Len-1;i++)
{
g = 1.0/(Coeff*t+1);
if (t <= 0.5 ) g = 1;
beta = MathCos(pi*t);
alfa = g * beta;
price = iMA(NULL,0,1,0,MODE_SMA,Price,shift+i);
Sum += alfa*price;
Weight += alfa;
if ( t < 1 ) t += 1.0/(Phase-1);
else if ( t < Len-1 ) t += (2*Cycle-1)/(Cycle*Length-1);
}
if (Weight > 0) MABuffer[shift] = Sum/Weight;