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 Professional Forum
OmniScripts
Looking for OmniLanguage Help
Last Activity 9/1/2024 11:18 PM
4 replies, 1102 viewings

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

^ Top
Diamondjag

Legend
100100100100
Posts: 404

Joined: 3/12/2006
Location: Brighton, Colorado

User Profile
 
Subject : Looking for OmniLanguage Help
Posted : 10/3/2019 12:50 PM
Post #30536

I'm looking for an OmniLanguage function that would look for a 250 day low then trigger a sell order if the RSI(5) goes above 85 in the next 4 days. I got a start but don't know how to incorporate the RSI within the next four days.

Any help would be appreciated. Thanks.


IF L=LLV(250) and RSI(5) >= 85 Then

Signal = ShortSignal

End If
^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

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

User Profile
 
Subject : RE: Looking for OmniLanguage Help
Posted : 10/3/2019 1:04 PM
Post #30537 - In reply to #30536

Hi, Dave

The trick is to check the 250-day-low condition for five days PRIOR, and the four bars SINCE then. OT/OL don't allow looking into the future. ;~)

IF L[5]=LLV(250)[5] and HHV(RSI(5),4) >= 85 Then Signal = ShortSignal

However, that simple approach will create a ***delayed*** entry signal if the RSI rule is met on days 1-3 after the low rule is met.

The correct way to do it is to ask if the RSI rule is met TODAY, and if so, check back for the Low rule being satisfied in the "acceptable" window:

dim gI as integer
If RSI(5) >= 85 then
for gI = 1 to 4
if L[gI]=LLV(250)[gI] then
Signal = ShortSignal
exit for
end if
next gI

This will give you the earliest possible entry signal that meets your rules. The forum doesn't permit indentation but hopefully you can follow it OK.

Note that LLV is an "inefficient" function, so this code tries to minimize its use ... an efficient workaround to LLV for this application requires a lot more code. I doubt that you'd notice the difference, unless your rule allowed for the prior lowest-low to occur a long time before the RSI rule.


[Edited by Jim Dean on 10/3/2019 1:06 PM]

^ Top
Diamondjag

Legend
100100100100
Posts: 404

Joined: 3/12/2006
Location: Brighton, Colorado

User Profile
 
Subject : RE: Looking for OmniLanguage Help
Posted : 10/3/2019 2:04 PM
Post #30538 - In reply to #30537

Jim,

Always happy when I see you respond to an Omni Language question.

I copied what you sent. Probably did something wrong at the end. Got a message that said that line 15 needed a closing "end if". What am I missing here?

Thanks



[Edited by Diamondjag on 10/3/2019 2:06 PM]

Attached file : Low Pullback.JPG (16KB - 494 downloads)

^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

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

User Profile
 
Subject : RE: Looking for OmniLanguage Help
Posted : 10/3/2019 2:11 PM
Post #30540 - In reply to #30538

Here is the corrected code with final end if, in pretty indentation form that makes the whole thing more understandable:



[Edited by Jim Dean on 10/3/2019 2:12 PM]

Attached file : code snippet with indentation.png (5KB - 523 downloads)

^ Top
Diamondjag

Legend
100100100100
Posts: 404

Joined: 3/12/2006
Location: Brighton, Colorado

User Profile
 
Subject : RE: Looking for OmniLanguage Help
Posted : 10/3/2019 2:18 PM
Post #30541 - In reply to #30540

Added the "end if" and it works nicely. Will now go in and pretty it up with the indentations.

Thank you so much!
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.