logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
underground  
#1 Posted : Monday, July 25, 2005 11:42:08 PM(UTC)
underground

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/23/2005(UTC)
Posts: 37

Ok I'm having a little problem writing an indicator, I have tried to write it the following ways. 1. If(Roc(Fml("Name"),1,$)>0,1,If(Roc(fml("Name"),1$)<0,-1,0)) 2. If(roc(fml("Name"),1,$)>0,1,-1) 3. If(Fml("Name") > Ref(fml("Name"),-1)1,0) *For testing purpose only The problem within the indicator seems to be an internal problem when it’s trying to calculate the output values. The indicator called "Name" plots correctly without any problems - it increases and decreases like is suppose without any problems but when I try to create the above indicators which reference the “name” indicator for some reason it has a had time calculating if the "Name" indicator is increasing or decreasing the above indicators plots the correct value’s some times but the majority of the time it does not and thus just produces a zero value output value. Any suggestions?
henry1224  
#2 Posted : Tuesday, July 26, 2005 1:05:10 AM(UTC)
henry1224

Rank: Advanced Member

Groups ready for retrieval: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
(Roc(Fml("Name"),1,$)>0)-(Roc(Fml("Name"),1,$)<0) Should work It would help if you could disclose the formula "Name" so that we could determine the exact cause! Why is it that new users are hesitant to disclose their code? Do you think that it is the holy grail? I have over 1700 indicators and 1000 experts! Do I use them all? No! I use only the indicators and experts that I find useful and those that I truly understand!
wabbit  
#3 Posted : Tuesday, July 26, 2005 1:20:29 PM(UTC)
wabbit

Rank:: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Have you tried: x:=Fml("Name"); Roc(x,1,$)>0; that will return a value of TRUE (1) or FALSE (0) The problem could very well be with the private indicator. Please see : http://forum.equis.com/viewtopic.php?t=933 for information on code posting. wabbit :D
underground  
#4 Posted : Wednesday, August 17, 2005 9:13:50 PM(UTC)
underground

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/23/2005(UTC)
Posts: 37

Sorry I been away for a few weeks and haven't had a chance to look at this post. Ya I tried that last formula still not working. This is what I have been using and trying to get it to work: "All Three Increasing or Decreasing" If(ROC(Fml("Name_A"),1,$)>=0,1, If(ROC(Fml("Name_A"),1,$)<=0,-1,0)) + If(ROC(Fml("Name_B"),1,$)>=0,1, If(ROC(Fml("Name_B"),1,$)<=0,-1,0)) + If(ROC(Fml("Name_C"),1,$)>=0,1, If(ROC(Fml("Name_C"),1,$)<=0,-1,0)) Part A and Part B work fine, together or seperataly. When I test Part C by itself or with Part A or B thats when the error occur's within the formula output value, it sometimes get's the correct value and most of the time it skips the output value thus returning a zero value. Thus in turn giving the wrong total value. Here the formula for "Name_C" X:Security("online:$vold",C); If(X<0,X,0)*10; If(X>0,X0)*10; I think the error that is occuring adding Part C to "All Increasing or Deceasing" might be caused do to multiple level call functions, what do you think any suggestions to correct this? Undgerground
wabbit  
#5 Posted : Thursday, August 18, 2005 11:33:54 AM(UTC)
wabbit

Rank:: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
You're missing the equals sign in the variable declaration: X:Security("online:$vold",C); should be...... X:=Security("online:$vold",C); and you're missing a comma from the last line: If(X>0,X0)*10; should be...... If(X>0,X,0)*10; In the code: X:=Security("online:$vold",C); If(X<0,X,0)*10; If(X>0,X,0)*10; will return 10*X in every instance except when X=0 !!!! Is that right? I suggest you check your logic again. wabbit :D
wabbit  
#6 Posted : Thursday, August 18, 2005 1:45:46 PM(UTC)
wabbit

Rank:: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
underground wrote:
"All Three Increasing or Decreasing" If(ROC(Fml("Name_A"),1,$)>=0,1, If(ROC(Fml("Name_A"),1,$)<=0,-1,0)) + If(ROC(Fml("Name_B"),1,$)>=0,1, If(ROC(Fml("Name_B"),1,$)<=0,-1,0)) + If(ROC(Fml("Name_C"),1,$)>=0,1, If(ROC(Fml("Name_C"),1,$)<=0,-1,0))
I would also check the logic here again too! Have you ever heard of a tool called a truth table or logic table? They are an invaluable coding/programming tool that allows you to see what the results of an algorithm are, to make sure the code performs as intended. A simple example, for the AND boolean operator:
A B A AND B
0 0 0
0 1 0
1 0 0
1 1 1
In your case the table might look like: X:=ROC(Fml("Name_A"),1,$); Z:=If(X>=0,1,If(X<=0,-1,0))
X Z
0 1
1 1
10 1
-1 -1
-10 -1
Now although your function return the right results, we can use the truth table to see that Z variable never returns 0. This is because the Z variable has only two states, and you have coded three states. We can then re-write the Z variable as: Z:=If(X>=0,1,-1) which is simpler and probably less prone to error! Remember: when using referential operators the combinations to be considered are: = equal <> not equal to < less than > greater than <= less than or equal to >= greater than or equal to In some serious programming applications (investing is a serious concern to most of us!?) all six situations should be considered, if not coded into the program. If you follow these rules and use these tools against your code, you will see the flawed logic in your code. Your indicator can return integer values between 3 and -3, including zero. Unless you are only looking for the extreme values (3 and -3) then you are going to be in a lot of trouble when trying to create the filter for the possible scenarios that lead to these other results. I suggest you have another read of the guidelines for posting code, rethink what you are trying to achieve, write it down in very clear and precise simple terms, post it here, code it in MS and post it here too. We can then help you achieve the results you seek. Hope this helps. wabbit :D
wabbit  
#7 Posted : Thursday, August 18, 2005 2:01:46 PM(UTC)
wabbit

Rank:: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
The better way to test for the condition I think you are trying to achieve is: If you want to find the situation when all three conditions are increasing or decreasing, then logically speaking, you are searching for the condition when all three conditions are not the same as they were previously, or in another way, all three conditions are changing. --8<------------------------ {condition A is not steady, ie it is changing} AIsChanging:=ROC(Fml("Name_A"),1,$)<>0; {condition B is not steady, ie it is changing} BIsChanging:=ROC(Fml("Name_B"),1,$)<>0; {condition C is not steady, ie it is changing} CIsChanging:=ROC(Fml("Name_C"),1,$)<>0; {below will equal three when and only when all three conditions above are true, that is all three conditions are changing} AIsChanging+BIsChanging+CIsChanging=3 --8<------------------------ To extend the idea further: If you were looking for a situation when ONLY two of the three conditions were changing, then just revise the last line as follows: AIsChanging+BIsChanging+CIsChanging=2 If you were looking for a situation when AT LEAST two of the three conditions were changing, then just revise the last line as follows: AIsChanging+BIsChanging+CIsChanging>=2 If I have understood what you are trying to achieve correctly, I think you will have better luck with this attempt. wabbit :D
underground  
#8 Posted : Thursday, August 18, 2005 5:07:12 PM(UTC)
underground

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 3/23/2005(UTC)
Posts: 37

Wow sorry for the fat figners that was my fault when I tried to post the code within the forum. Second thanks for the tips I will play around with things today and see how it goes. I will be back to let you know.
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.