![]() |
|
| Discuss Discussion on kolkata meet signal at the MetaStock within the Traderji.com - Discussion forum for Stocks Commodities & Forex; Originally Posted by kkseal Ok, first things first In Sanjay's code (AFL not MS code) ... |
|
|||||||
| Notices |
![]() |
|
|
Thread Tools |
| Sponsored Links |
|
#51
|
|||
|
|||
|
Quote:
... this time the Pi felloso 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 So it was worth bothering, hopefully the results will change now that we have a fix in place. Well at last we found something to agree on ![]() rgrds Sanjay |
| Sponsored Links |
|
#52
|
|||
|
|||
|
Right. Code Edited.
![]() I was using Rad values straightaway. (Currently grappling with ways to deal with EVEN periods )Regards, Kalyan. |
|
#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();
|
|
#54
|
|||
|
|||
|
Any "correction" required in MS code to make it give better results!!!!!
|
|
#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 by kkseal; 22nd April 2008 at 09:13 PM. |
|
#56
|
|||
|
|||
|
Quote:
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 |
|
#57
|
|||
|
|||
|
Quote:
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 |
|
#58
|
|||
|
|||
|
Sanjay, pls see if you can detect the error in this piece of code (possibly in the IF condition)
HTML Code:
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;
}
Regards, Kalyan. |
|
#59
|
|||
|
|||
|
Quote:
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 |
|
#60
|
|||
|
|||
|
Yeah got it. Only 'i' will not do for even pds.
Regards, Kalyan. |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Indemnity, Disclaimer & Disclosure
Notice:
• By visiting Traderji.com you indicate your acceptance of our Forum
Rules Disclaimer & Disclosure and indemnify Traderji.com, its
associates and related parties of all claims howsoever resulting from
the usage of the forum.
• Disclaimer: Trading or investing in stocks & commodities
is a high risk activity. Any action you choose to take in the markets
is totally your own responsibility. Traderji.com will not be liable for
any, direct or indirect, consequential or incidental damages or loss arising out of the use of this information.
• Disclosure: The information in this forum is neither an offer to sell nor solicitation to buy any of the securities mentioned herein.
The writers may or may not be trading in the securities mentioned.
• All names or products mentioned are trademarks or registered trademarks of their respective owners.
General Content Disclaimer Notice:
In light of our policy of encouraging candid, open exchanges of views and the rapid distribution of information originating from many sources, Traderji.com cannot determine the accuracy of information that may be uploaded to the forum. Opinions, advice and all other information expressed by participants in discussions are those of the author. You rely on such information at your own risk. You are urged to seek professional advice for specific, individual situations and not rely solely on advice or opinions given in the discussions. Since Traderji.com is an open and free discussion forum, any comments made by members of this forum in their posts reflect their own views and not of the owner or administrator of Traderji.com. Thus the owner/administrator indemnify themselves of all claims whatsoever and will not be liable or responsible for any members comments/views in this forum Traderji.com. If you find any objectionable or offensive posts made by members of this forum which you would like to bring to our notice for removal then please Contact Us.