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

Notification

Icon
Error

Options
Go to last post Go to first unread
WindsurfStew  
#1 Posted : Sunday, June 15, 2008 4:52:05 PM(UTC)
WindsurfStew

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/28/2006(UTC)
Posts: 8

Hi Group,

1) PARAMETER PASSING TO FUNCTIONS - Is there any way to pass parameters to custom functions? For example I create a function using function builder named myFunction which has a user input for period. Is there any way to call it like Fml("myFunction", 14) if I want it for a period of 14 say?

2) CHARACTER LIMITS - Is there any easy way to get around the character limits in functions and explorer? I'm trying to do something like this in explorer to use a different RSI Threshold depending on the security -

limit:=If(ExtFml("myDll.myFunction","LNC.AX"),7,-1);
limit:=If(ExtFml("myDll.myFunction","LNN.AX"),9,-1);
limit:=If(ExtFml("myDll.myFunction","LWB.AX"),9,-1);
...
limit:=If(ExtFml("myDll.myFunction","MGR.AX"),3,-1);

RSI(C,2) <= limit

I'm trying to set the value of 'limit' based on the security I'm dealing with but am coming up with two issues. Firstly the character limit is exceeded and secondly there seems to be no 'switch' type statement so that in the above example, successive calls to 'If' will overwrite the previously assigned value. For example if the security is LNC then limit will be set to 7 but then revert to -1 on the next call. The alternative is nesting If statements which is sloppy too.

I guess that I could try hard coding my long formula and values into an external dll, but it's not a particularly elegant solution either.

Thoughts anyone?

Stewart

wabbit  
#2 Posted : Sunday, June 15, 2008 6:35:48 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)
windsurfStew wrote:
1) PARAMETER PASSING TO FUNCTIONS - Is there any way to pass parameters to custom functions? For example I create a function using function builder named myFunction which has a user input for period. Is there any way to call it like Fml("myFunction", 14) if I want it for a period of 14 say?
Unfortunately, no.

windsurfStew wrote:
2) CHARACTER LIMITS - Is there any easy way to get around the character limits in functions and explorer? I'm trying to set the value of 'limit' based on the security I'm dealing with but am coming up with two issues. Firstly the character limit is exceeded and secondly there seems to be no 'switch' type statement so that in the above example, successive calls to 'If' will overwrite the previously assigned value. For example if the security is LNC then limit will be set to 7 but then revert to -1 on the next call. The alternative is nesting If statements which is sloppy too.
Nesting the If() statements doesn't have to be sloppy, and if done properly will save you a few characters too! It also means the If() values will not be reset for each true/false comparison which then returns the desired correct results.

Code:
limit:=
If(ExtFml("myDll.myFunction","LNC.AX"),7,
If(ExtFml("myDll.myFunction","LNN.AX"),9,
If(ExtFml("myDll.myFunction","LWB.AX"),9,
...
If(ExtFml("myDll.myFunction","MGR.AX"),3,
-1))));

RSI(C,2) <= limit

windsurfStew wrote:
I guess that I could try hard coding my long formula and values into an external dll, but it's not a particularly elegant solution either.
There are many solutions to this problem, all of them include the use of .dll addins. The simplest addin solution will be to keep a list of the stock tickers and the corresponding RSI value and have the function read the file and return the right value for that symbol.


Hope this helps.

wabbit [:D]


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.