Discussion on kolkata meet signal

SGM

Active Member
#51
Ok, first things first

In Sanjay's code (AFL not MS code) insert

a = 22/(7*a);

after 1st line.

This'll solve a basic problem (& regenerate interest in the indi :)).

Regards,
Kalyan.
hmm another of those greeks :mad: ... this time the Pi fello

so we use another conversion radians/degrees.. interesting

but shouldn't it be a = (22/7) * (a / 180)

anyway use what kalyan says, i have not tested this, he must have tested the code

Why bother when the results are so bad? :)
So it was worth bothering, hopefully the results will change now that we have a fix in place.

(Not many will be interested anyway)
Well at last we found something to agree on :)

rgrds
Sanjay
 

kkseal

Well-Known Member
#52
Right. Code Edited. :p

I was using Rad values straightaway.
(Currently grappling with ways to deal with EVEN periods :))

Regards,
Kalyan.
 

SGM

Active Member
#53
No sweat, here we go

Code:
_SECTION_BEGIN("Asish_Indicator_01");
a  =  Param("Angle",30,15,45,1);
a  =  (22/7) * (a/180);  

Num = 0;
Den = 0;

n  = Param("Sin_Len",3,1,100,1);

for (i = 1;i < n+1;i++)
{
	Num = Num + sin(n*a) * Ref(C,-n-1) ;
	Den = Den + sin(n*a);
}

j1 = Num / Den;
Plot(IIf(j1 > Ref(j1,-1),-10,10),"j1",IIf(j1 > Ref(j1,-1),colorBlueGrey,colorLime), styleThick);

_SECTION_END();
 

kkseal

Well-Known Member
#55
The weighting has to be consistent (triangular) for both even & odd lengths(periods) Here's what i suggest for a 6 period SWMA

Num = (sin(1*a) * P) + (sin(2*a) * Ref(P,-1)) + (sin(3*a) * Ref(P,-2)) + (sin(3*a) * Ref(P,-3)) + (sin(4*a) * Ref(P,-4)) + (sin(5*a) * Ref(P,-5));
Den = sin(a) + sin(2*a) + sin (3*a) +sin(3*a) + sin(4*a) + sin(5*a);

And for 4 period :-
Num = (sin(1*a) * P) + (sin(2*a) * Ref(P,-1)) + (sin(2*a) * Ref(P,-2)) + (sin(3*a) * Ref(P,-3)) ;
Den = sin(a) + sin(2*a) + sin (2*a) +sin(3*a);

For a = 30(degrees) the respective Sine weights would be

For 4 pd : sin30, sin60, sin60, sin30
For 6 pd : sin30, sin60, sin90, sin90, sin60, sin30

Whereas for 5 pd(ODD) it is
sin30, sin60, sin90, sin60, sin30

Correct if wrong.

Regards,
Kalyan.
 
Last edited:

SGM

Active Member
#56
The weighting has to be consistent (triangular) for both even & odd lengths(periods) Here's what i suggest for a 6 period SWMA
Hello Kalyan

This is all over the head for me. I never understood the logic behind this indicator. Was just trying to convert it to afl. Its good that you took over the amibroker part of the project.

I think now you and asish should give the members some sort of conceptual inputs / background. (well only if some interest is expressed)

As for me, cycles stuff is way out of line of my current studies. Also I am not currently looking for developing new indicators etc.

Was fun coding/testing. I hope something usable comes out of this project.

Once you stabilize the indicator/signal code, It would interesting to try to build a system around it. If needed, can chip in with coding/testing.

Regards
Sanjay
 

SGM

Active Member
#57
Any "correction" required in MS code to make it give better results!!!!!
Hello RK

No change is needed in the MS code, the change in afl is required because of a bug / error in the afl code.

Now Kalyan has proposed some changes, that are yet to be coded in ami or MS

Regards
Sanjay
 

kkseal

Well-Known Member
#58
Sanjay, pls see if you can detect the error in this piece of code (possibly in the IF condition)

HTML:
pd=6;

Num = 0;
Den = 0;

for(i=1; i<=pd; i++)
{
	if(pd%2==0 AND i==(pd/2+1)) X = sin((i-1)*a);
	else X = sin(i*a);
	Num = Num + X*Ref(P,1-i);
	Den = Den + X;
}
i have taken fixed period=6 for testing. 'a' & the rest of the stuff is same as before.

Regards,
Kalyan.
 

SGM

Active Member
#59
For a = 30(degrees) the respective Sine weights would be

For 4 pd : sin30, sin60, sin60, sin30
For 6 pd : sin30, sin60, sin90, sin90, sin60, sin30

Whereas for 5 pd(ODD) it is
sin30, sin60, sin90, sin60, sin30
Hello Kalyan

Coding this should be simple, use a counter to count up (till i = n/2) and then down inside the for loop, use the count instead of i for the angle

rgrds
 

Similar threads