Discussion on kolkata meet signal

SGM

Active Member
#61
Code:
_SECTION_BEGIN("Kalyan_Modification");
a  =  Param("Angle",30,15,45,1);
a  =  (22/7) * (a/180);  

Num = 0;
Den = 0;

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

Count = 0;
for (i = 1;i < n+1;i++)
{
	if ((n%2 == 0) AND (i == n/2 + 1))  Count = Count;
	else
	{
	if (i <= n/2) Count = Count + 1;
	else Count = Count -1;
	}

	Num = Num + sin(Count*a) * Ref(C,-i-1) ;
	Den = Den + sin(Count*a);
}
j1 = Num / Den;
Plot(IIf(j1 > Ref(j1,-1),-10,10),"j1",IIf(j1 > Ref(j1,-1),colorBlueGrey,colorLime), styleThick);
chk if this is what u want,

edit: ok understood the prob with even num, will fix it
edit: Done, now check it
 
Last edited:

kkseal

Well-Known Member
#62
Ok this seems to be working

HTML:
for(i=1; i<=pd; i++)
{
	if(pd%2==0 AND i > pd/2) X = sin((i-1)*a);
	else X = sin(i*a);
 
	Num = Num + X*Ref(P,1-i);
	Den = Den + X;
}
Will do some more checking with odd/even periods later.

Regards,
Kalyan.
 
Last edited:

renu daga

Well-Known Member
#64
hi
gsm...

since i got apm from u,,,regarding asish das signal,,as u wanted it,,,so kindly check the link in kolkata meet thread where sunando da has uploaded the signal
since th e signal file is more than 100...kb so i can post it here for u,,
still any problem,,then add me to ur messenegr id if u ahve i can transfer teh indicator file to u,,,no problem

renu
 

kkseal

Well-Known Member
#65
Code for the Indicator:-

HTML:
_SECTION_BEGIN("Asish_Indicator_01");

a  = Param("Angle",30,15,45,1);
pd = Param("Period",5,4,6,1);
P = ParamField("Price field",3);

a= (22/7)*(a/180);
Num = 0;
Den = 0;

for(i=1; i<=pd; i++)
{
	if(pd%2==0 AND i > pd/2) X = sin((i-1)*a);
	else X = sin(i*a);
 
	Num = Num + X*Ref(P,1-i);
	Den = Den + X;
}

if (den!=0)  j1 = Num / Den;

Plot(j1,"j1",IIf(j1 > Ref(j1,-1),colorBlueGrey,colorLime),styleThick);

_SECTION_END();
TEST CODE :-
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 5 period :-
Num = sin(1*a) * P + sin(2*a) * Ref(P,-1) + sin(3*a) * Ref(P,-2) + sin(4*a) * Ref(P,-3) + sin(5*a) * Ref(P,-4);
Den = sin(a) + sin(2*a) + sin (3*a) + sin(4*a) + sin(5*a);

For 6 period :-
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);

Beyond the 4-6 period range the Sine weighting does not make sense imo. (Restricted to half-a-cycle. If i remember correctly John Ehler does the same for his Sine Wave oscillator)

Regards,
Kalyan.
 
Last edited:
U

uasish

Guest
#66
Kalyan,

Yes this statement of your post .........
"(Restricted to half-a-cycle. If i remember correctly John Ehler does the same for his Sine Wave oscillator)"
i have experimented few & found to be right.Nice exercise going on ,mostly by you & Sanjay.A Learning process of how things are approached ;may be this indicator is not upto the mark but still this is how conceptually things are approached than simple Copy Paste,thks for showing us.

Asish
 

kkseal

Well-Known Member
#68
Kalyan,

Yes this statement of your post .........
"(Restricted to half-a-cycle. If i remember correctly John Ehler does the same for his Sine Wave oscillator)"
i have experimented few & found to be right.Nice exercise going on ,mostly by you & Sanjay.A Learning process of how things are approached ;may be this indicator is not upto the mark but still this is how conceptually things are approached than simple Copy Paste,thks for showing us.

Asish
Actually Asishda, as a MA, i don't think this is a bad one. Good balance of smoothness & response. It'll carry the usual disadv of MAs off-course, but even then i think new testing will yield better results. We also need to rethink the entry. More later.

Regards,
Kalyan.
 

kkseal

Well-Known Member
#70
Sorry folks. Too price hugging too avoid whipsaws. A few can be avoided by using (H+L)/2 or avg price* as the price field with Sanjay's code (few more by using a technique i use with MAs though it's a little discretionary) but most remain.

Maybe someone will come up with a better idea.

Regards,
Kalyan.

* (H+L+C)/3 in Ami
 

Similar threads