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.


Only Forum Moderators, Administrators, and the owner of this message may delete it.

 
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]

Deleting message 30537 : RE: Looking for OmniLanguage Help


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