OmniTrader Professional Forum OmniTrader Professional Forum
forums calendars search
today this week
 
register logon control panel Forum Rules
You are currently browsing as a guest.
You should logon to access more features
A Self-Moderated Community - ALL MEMBERS, PLEASE READ!
Vote for Members who contribute the most to your trading, and help us moderate content within the Forums.


[Random Quote] -

  Current location        Thread information  
OmniTrader Pro Resource Forum
OmniLanguage Frequently Asked Questions
How do I reference my OmniLanguage script?
Last Activity 12/2/2008 10:19 AM
0 replies, 7930 viewings

Jump to page : 1
Now viewing page 1 [25 messages per page]
 
back reply
Printer friendly version

^ Top
Matthew Greenslet

Idol
2000252525
Posts: 2077

Joined: 2/27/2006

User Profile
 
Subject : How do I reference my OmniLanguage script?
Posted : 12/2/2008 10:19 AM
Post #10673

OmniLanguage indicators can be referenced in other OmniLanguage Scripts, Color Charts, OmniScan lists, Setups, and Strategy Filters. Your scripts will not show in the list to the right in the formula builder; however, all you need to do to reference your script is to call it by the same name of the file you created. It is important to note that if your script contains and #PARAM statements you MUST pass in the value you want to use for the parameter.

For example I have created a new indicator called MySMA. The code used is as follows.

#Indicator
#PARAM "Periods", 20
Dim fSMA as Single

fSMA = Sum(Close, Periods)
fSMA /= Periods

PlotPrice("SMA", fSMA)

Return fSMA

If I wanted to reference this indicator elsewhere, say a color chart, I would simply type MySMA(15). Notice how I am passing in 15 to tell my color chart rule what periodicity I want to use. Say I added a second parameter to MySMA, perhaps a second periodicity to smooth the SMA. Again I need to tell it what values to use for the parameters so I would call it by typing MySMA(15, 40).

If your script contains no parameters you MUST still use empty parenthesis such as MySMA(). If you do not have the parenthesis at the end, other scripts will view it as a variable and not a function call to your indicator which will result in a compile error telling you MySMA is not defined.
Jump to page : 1
Now viewing page 1 [25 messages per page]
back reply

Legend    Action      Notification  
Administrator
Forum Moderator
Registered User
Unregistered User
E-Mail this thread to a friend
Toggle e-mail notification


Nirvana Systems
For any problems or issues please contact our Webmaster at webmaster@nirvsys.com.