|
kmcintyre
 Veteran
  Posts: 132
Joined: 9/12/2007
Location: Valley Center, CA
User Profile |
Many standard indicators offer mulptiple variations of parameters (signatures).
RSI(14) vs. RSI(Data, 14)
SMA(50) vs. SMA(Data, 50)
etc.
I would like to be able to pass a data series into my #indicator too!
And if I don't pass a Data series, I would like to default to the current symbol's Close.
(This is known as operator overloading...)
Is there a way to do this in OL?
Thanks
|
|
Ryan Olson
 Veteran
   Posts: 170
Joined: 12/29/2006
Location: Austin, Tx
User Profile |
Good Afternoon,
Most of our indicators and systems have the ability to do this and are indicated with a small triangle showing there are additional options.
Not every one but many. Attached is a screenshot of what to look for.
Attached file : forum.png (2KB - 188 downloads)
|
|
Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
no
|
|
kmcintyre
 Veteran
  Posts: 132
Joined: 9/12/2007
Location: Valley Center, CA
User Profile |
And that's what I love about OL...
|
|
Ryan Olson
 Veteran
   Posts: 170
Joined: 12/29/2006
Location: Austin, Tx
User Profile |
The answer isn't as easy as "no".
You can pass quite a few things into indicators:
For example, SMA can take SMA(50), SMA(V,50) SMA((C-H), 50) but not tuples, dictionaries but you are able to pass some information directly into indicators.
If you are building the indicator you will only be able to pass the parameters you have built in but not data series.
However, inside the indicator you are in control, you can calculate whatever you want, you have access to price, volume, read from data files and more.
As far as "true" overloading operators - this is a concept used in OOP programming and not completely implemented in OmniLang.
|
|
Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
Ryan, the answer IS simply “no”.
You can only pass numeric constants into OmniLanguage routines. Period.
In fact, if you try to reassign the value of the parameter inside the OL routine, it won’t work.
It is a constant.
Otoh, all variables dim’d inside the routine are one-dimensional arrays, even though they have a “hidden” index [bar].
There are a few dozen system-reserved words such as Numrec that are constants as well.
As simple as that.
|
|
Jim Dean
 Sage
       Posts: 3433
Joined: 3/13/2006
Location: L'ville, GA
User Profile |
As to overloading …
If you define an OL indicator with three Params, then if you call it from an OScript or another OLang routine, you MUST specific exactly Three params in the call.
You cannot specify more or leas than three.
Overloading is a programming option that allows extra params to be spec’d.
Impossible in OLang.
Simple as that.
|