Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/15/2005 Posts: 9
|
I'm new here and trying to pick up realcode. I'd like to create a function which I can then use on custom indicators As an example, I would like to be able to process a given indicator (such as RSI or Stochastic) to determine whether there has been a change in the rate of change between the current bar and previous bar as compared to previous bar and the preceeding bar.
Presumably, this function could then be called like any other function (AVG, XAVG) for any other indicator.
Is this possible?
|
|
Administration
Joined: 9/18/2004 Posts: 3,522
|
You cannot currently make your own global functions. (like AVG, XAVG). This is functionality we would like to include in a future release.
Ken Gilb (Kuf) Chief Software Engineer - Worden Brothers Inc. Try/Catch - My RealCode Blog
|
|
Registered User Joined: 12/31/2005 Posts: 2,499
|
You can however write a general function and then cut and paste it into the class modude and call it from your condition or indicator
place code witn class module like so:
function whatever(current as single, previous as single, preceeeding as single) as single
dim val
'
' insert logic here
'
whatever = val
end function
end class
and then just make calls to the function
value = whatever(RSI.value,RSI.value(1),RSI.value(2))
|
|
Registered User Joined: 10/15/2005 Posts: 9
|
Bingo. Exactly what I was looking for. Thanks all.
|
|
Guest-1 |