OmniTrader Forum - OmniTrader General Discussion
SymbolID Function example

^ Top
Mario M

Posts: 9

Joined: 8/2/2004

User Profile
 
Subject : SymbolID Function example
Posted : 4/3/2024 12:15 PM
Post #48901


Does anyone have a working example on how to implement the SymbolID function into OmniLanguage?

I get the symbol reference# but how is this applied to a formula?

Simple example: SymbolID("")=5425 SMA(10) > SMA(20)

How would this be written?

Thanks!
^ Top
Barry Cohen

Posts: 6338

Joined: 1/19/2004

User Profile
 
Subject : RE: SymbolID Function example
Posted : 4/4/2024 12:09 PM
Post #48902 - In reply to #48901

Good question! It depends on what you're after.

So 5425 is SPY & you're wanting the filter to pass all symbols only if the SMA(10) > SMA(20) on SPY is true? Or do you want the filter to pass if the symbol is SPY as well as the SMA(10) > SMA(20) is true?

This formula will pass any symbol if SPY's SMA(10) is greater than SPY's SMA(20).

SMA(GetClose("SPY"),10) > SMA(GetClose("SPY"),20)

That could also be written like this.


This formula will pass ONLY the SPY if SPY's SMA(10) is greater than SPY's SMA(20). All other symbols will not pass.

SymbolID("") = 5425 AND SMA(10) > SMA(20)

Attached file : SymbolID.png (13KB - 290 downloads)

^ Top
Mario M

Posts: 9

Joined: 8/2/2004

User Profile
 
Subject : RE: SymbolID Function example
Posted : 7/18/2024 5:09 PM
Post #48923 - In reply to #48901

Hey Barry,

Sorry for the delayed response.

What I am after is in omni language for a stop.
I use many references to $SPX in my formulas and am trying to write a stop referencing the stop value of the $SPX for the given symbol.

STOP EX: if SMA($SPX) > SMA($SPX)[1] then exit signal....
My formulas are complex but the syntax will(should) work regardless.

Thanks for the help!


^ Top
Barry Cohen

Posts: 6338

Joined: 1/19/2004

User Profile
 
Subject : RE: SymbolID Function example
Posted : 7/22/2024 10:56 AM
Post #48924 - In reply to #48923

STOP EX: if SMA($SPX) > SMA($SPX)[1] then exit signal....


In that case you would not use SymbolID. You could have an OmniScript stop set to a condition like this...

SMA(GetClose("$SPX"),10) > SMA(GetClose("$SPX"),20)

^ Top
Mario M

Posts: 9

Joined: 8/2/2004

User Profile
 
Subject : RE: SymbolID Function example
Posted : 7/24/2024 6:14 PM
Post #48925 - In reply to #48901

Thanks Barry for the help.

One of the indicators that I use out of the box is SuperTrend but I am having trouble writing this referencing $spx.

Tried many ways using your example with no luck.
Any ideas?
^ Top
Barry Cohen

Posts: 6338

Joined: 1/19/2004

User Profile
 
Subject : RE: SymbolID Function example
Posted : 7/26/2024 9:30 AM
Post #48926 - In reply to #48924

It looks like the SuperTrend indicators don't have a data parameter available like in the above example. I'll see if I can get it added in a pre-release.
^ Top
Mario M

Posts: 9

Joined: 8/2/2004

User Profile
 
Subject : RE: SymbolID Function example
Posted : 7/26/2024 6:19 PM
Post #48927 - In reply to #48901

I thought it was me.
Thanks!


https://www.omnitrader.com/currentclients/otforum/thread-view.asp?threadid=16648&posts=7