OmniTrader Professional Forum - OmniLanguage Discussion
String #PARAMs

^ Top
kmcintyre

Posts: 132

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
 
Subject : String #PARAMs
Posted : 10/11/2020 8:33 PM
Post #31263

I noticed that Ed had a #indicator that accepted a String as a #PARAM.

I have not been able to get Strings to work as #PARAMs.

Does anyone know the syntax required for String #PARAMs?

Thanks

^ Top
Ryan Olson

Posts: 170

Joined: 12/29/2006
Location: Austin, Tx

User Profile
 
Subject : RE: String #PARAMs
Posted : 10/12/2020 9:40 AM
Post #31265 - In reply to #31263


Hey Keith,

I assume you are talking about his HRS seminars.

Const RefSymbol as String = "SPY"

This is using the Const statement which declares a constant and sets its value. So later in the code you see where Ed uses HRSDiff = HRS_DIFF(14,3,RefSymbol).

This assigns the value of HRSDiff to HRS_Diff(14, 3, "SPY"). Since HRS_Diff allows to pass the following "Periods", SMAPeriods", and RefSymbol - Ed assigned a constant value to RefSymbol and set it to SPY.

If this wouldn't have been set to a constant "const" then the value would have been the symbol you are currently on.

Not every system or indicator would allow you to set the const of a value.

Here is a site you can look at to get more information about Constants.
https://docs.microsoft.com/en-us/office/vba/language/concepts/getting-started/declaring-constants#:~:text=You%20use%20the%20Const%20statement,constant%20and%20set%20its%20value.&text=You%20can%20declare%20a%20constant,statement%20with%20the%20Public%20keyword.

Hope this helps,

Ryan Olson
Nirvana Systems
^ Top
Jim Dean

Posts: 3433

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

User Profile
 
Subject : RE: String #PARAMs
Posted : 10/12/2020 10:06 AM
Post #31266 - In reply to #31265

Thanks Ryan

In any OLang Stop, System or Indicator a user can declare String variables, then assign values to them in the code, and manipulate those values with VBA functions like left(), right(), instring() etc ... or concatenate them using &

What we CANNOT do, to the best of my knowledge, is INPUT a string variable via the #param command ... or for that matter, OUTPUT a string variable via the Return statement.

Of the two, probably an expanded #param command would be the most useful to OLang programmers ... that is, maybe something like this:

#paramStr "NameOfStringParam", "DefaultStringValue", "List,Of,Other,Standard,Values,For,A,Dropdown,Box"

Please add that to the enhancements list ... it would be really helpful!

Thanks
^ Top
Ryan Olson

Posts: 170

Joined: 12/29/2006
Location: Austin, Tx

User Profile
 
Subject : RE: String #PARAMs
Posted : 10/12/2020 10:07 AM
Post #31267 - In reply to #31263



Jim, we are currently working on the feature list of 2021 so I will add this to it.

Ryan
^ Top
Jim Dean

Posts: 3433

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

User Profile
 
Subject : RE: String #PARAMs
Posted : 10/12/2020 10:18 AM
Post #31268 - In reply to #31267

Thanks, Ryan.

Please ALSO add OLang related requests:

1. Return values use DOUBLE precision ... crucial for Forex support!

2. Plot command Width param's allow negatives, where -5 = displayed candle width (thus -1 to -10 widths would auto-scale with #bars displayed, while +1 to +10 would work as they do now)

3. Plot command new param to specify Style of line (dot, dash, solid etc)

... my guess is that those above should all be pretty straightforward to add to the parser ... fingers crossed!

4. Make ALL canned and plugin Nirvana functions (MACD, STO, etc) use Double Precision calcs instead of Single, including their Return values. Crucial for Forex support!

... that actually should be pretty simple to do, but a bit time-consuming ... it presumes that #1 above has already been implemented.

Thanks!

^ Top
SteveL

Posts: 133

Joined: 2/15/2007
Location: Boulder, CO

User Profile
 
Subject : RE: String #PARAMs
Posted : 10/12/2020 10:21 AM
Post #31269 - In reply to #31265

Hi, Ryan.
So, what symbols are defined as constants, and valid for use, in HRS_DIFF(), other than "SPY"?
^ Top
Ryan Olson

Posts: 170

Joined: 12/29/2006
Location: Austin, Tx

User Profile
 
Subject : RE: String #PARAMs
Posted : 10/12/2020 10:22 AM
Post #31270 - In reply to #31263



You can use any symbol you want in this case. AAPL, SPY, TSLA whatever you like. It will be using that symbol for that calculation.

Ryan
^ Top
kmcintyre

Posts: 132

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: String #PARAMs
Posted : 8/10/2021 3:04 PM
Post #31562 - In reply to #31263

Ryan

Could you post an example script that includes the syntax for passing a Symbol into a #indicator as a constant?

Thanks


^ Top
Jim Dean

Posts: 3433

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

User Profile
 
Subject : RE: String #PARAMs
Posted : 8/10/2021 3:56 PM
Post #31564 - In reply to #31562

You cannot pass strings into an OLang Indicator, System or Stop via a #param input. This has been requested many times but since Hans is gone now, I don't expect significant changes like that to be made to the OLang Parser for a very long time, if ever.

A few of the canned Nirvana indicators accept string param's in their lists, surrounded by double-quotation marks. I haven't done it myself, but I suspect you could code a custom Indicator using the SDK that would accept strings. But of course there is zero support avail for SDK coding work.
^ Top
kmcintyre

Posts: 132

Joined: 9/12/2007
Location: Valley Center, CA

User Profile
 
Subject : RE: String #PARAMs
Posted : 8/10/2021 9:20 PM
Post #31567 - In reply to #31263

I have used constants for decades, but neverr as a parameter variable. (Sounds like a contradiction to me...)

I was really hoping to see the OL that allowed me to pass a string to a user defined OL function.

Maybe Ryan can post something I can use in the future.

Onward...

.
^ Top
Vinay

Posts: 70

Joined: 1/18/2012
Location: Planet Earth

User Profile
 
Subject : RE: String #PARAMs
Posted : 8/12/2021 1:29 AM
Post #31571 - In reply to #31564

Originally written by Jim Dean on 8/11/2021 2:56 PM

This has been requested many times but since Hans is gone now, I don't expect significant changes like that to be made to the OLang Parser for a very long time, if ever.


It is very sad to note that Nirvana is losing its top talents one after another. Nirvana customers are staring at a very bleak future as far as future product development and support is concerned.



https://www.omnitrader.com/currentclients/proforum/thread-view.asp?threadid=7883&posts=11