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.


  Current location        Thread information  
OmniTrader Pro Resource Forum
OmniTrader Pro Technical Support
Programming ranges
Last Activity 6/18/2018 10:21 AM
3 replies, 367 viewings

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

^ Top
ZMTLock

Member

Posts: 16

Joined: 1/31/2016

User Profile
 
Subject : Programming ranges
Posted : 6/16/2017 12:06 PM
Post #29590

I'm trying to program ranges in OmniLanguage.

An example:

MACD_HIST(12,26,9) < 2.53465 and MACD_HIST(12,26,9) > 1.23655

Is there anyway to type that in a shorter, faster way?
^ Top
Jim Dean

Sage
2000100010025
Posts: 3128

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Programming ranges
Posted : 6/16/2017 3:40 PM
Post #29591 - In reply to #29590

If in OLang (i.e. A routine) and not OScript (i.e. Formula builder), you can dimension and assign a variable to hold the desired Macd value, then use that variable in the formula instead of typing out (and calc'ing) the macd twice. This may or may not seem to be "simpler" to you.

Otoh if you're working with an OScript formula, you have to do it the way you illustrated.
^ Top
ZMTLock

Member

Posts: 16

Joined: 1/31/2016

User Profile
 
Subject : RE: Programming ranges
Posted : 6/20/2017 2:42 PM
Post #29593 - In reply to #29590

Yes. I usually do that to shorten but let's say I have these ranges:

Dim mac, param1 as single

mac = MACD_HIST(12,26,9)

param1 = mac < 2.53465 and mac > 1.23655 or _
mac < 0.532654 and mac > -0.36256 or _
mac < -0.65252 and mac > -1.39584


Is there a more efficient way to code that without having to type out the full line everytime?
^ Top
Jim Dean

Sage
2000100010025
Posts: 3128

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Programming ranges
Posted : 6/20/2017 3:08 PM
Post #29594 - In reply to #29593

First of all, param1 should be dim'd boolean (tho single prob will work).

Secondly - I don't understand your question. You are testing a value against six other values (three ranges). You have to type in those values plus the ands and ors to express that.

Maybe you could post some "pseudocode" that would illustrate what you'd prefer to do.

The example you showed is simple VB. That's just way the language works.
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.