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
OmniLanguage Discussion
Omnilanguage Hi/Lo Question
Last Activity 7/6/2025 3:47 AM
4 replies, 1357 viewings

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

^ Top
Lou Venezia

Member
25
Posts: 25

Joined: 7/22/2022

User Profile
 
Subject : Omnilanguage Hi/Lo Question
Posted : 4/26/2023 10:58 AM
Post #32230

I created a system in Omnilanguage that calculates and plots a Gann result. The plot panel for every symbol has a range that is different for every symbol depending on the Gann calculation. Does anyone know how I can normalize the plots so that they reflect a consistent plot range with same high point, zero point and same low point similar to an oscillator. Also if I wanted to calculate the 100 day high and 100 day low of the calculated result, how would I do that?

Thanks
^ Top
Etherist

Member
25
Posts: 27

Joined: 6/9/2024
Location: South Australia

User Profile
 
Subject : RE: Omnilanguage Hi/Lo Question
Posted : 5/30/2025 7:46 AM
Post #32528 - In reply to #32230

Hi there Lou

Here's a possible solution to your question ... a long time coming, hey.


Normalizing Gann Output and 100-Bar Price Range in OmniTrader


The details below assume the following:

1. That your Gann calculation is returning a scalar value per bar (like an indicator) and not a set of levels/angles.

2. That you are plotting the Gann result using the Plot function.

3. That you want the normalized plot to always span from -1 to 1 (like RSI) and not from 0 to 100.

4. That you want the 100-day high/low based on price and not on your calculated Gann result.


To normalize a Gann-based oscillator use a min–max scaling on the recent Gann values. In practice, compute the rolling maximum and minimum of the Gann value series and map the current value into [–1,1].

Specifically, use OmniLanguage’s HHV and LLV functions to get these extremes: for example, HHV(H,n) (or simply HHV(n)) returns the highest high of the last n bars, and LLV(n) returns the lowest low. Nirvana (OmniTrader) documentation suggests normalizing indicators this way to make them comparable across symbols.

In formula terms:
• Compute GannMax = HHV(GannSeries,Period) and GannMin = LLV(GannSeries,Period) over your chosen lookback (e.g. 100 bars).
• Then set GannNorm = 2 * ((GannValue – GannMin) / (GannMax – GannMin)) - 1, ensuring to handle the case when GannMax = GannMin.

The steps are:
• Compute rolling HHV/LLV of the Gann values over NormPeriod.
• Apply min–max scaling: GannNorm = 2 * ((GannValue - GannMin) / (GannMax - GannMin)) - 1, which yields a value in [–1,1] (if GannMax>GannMin; otherwise set to 0). This follows the recommended (value – LLV)/(HHV–LLV) normalization.
• Compute the 100-bar price high/low directly from price: PriceHigh100 = HHV(H,100) and PriceLow100 = LLV(L,100).
• Plot each series using Plot(...).

###########################################

#Indicator
#PARAM "NormPeriod",100,1,1000
#PARAM "HLPeriod",100,1,1000

Dim GannValue As Double
Dim GannMax As Double
Dim GannMin As Double
Dim GannNorm As Double
Dim PriceHigh100 As Double
Dim PriceLow100 As Double
Dim High100 As Double
Dim Low100 As Double


' Example Gann calculation (replace with actual Gann formula)
GannValue = (H + L + C) / 3

' Rolling max/min of GannValue over NormPeriod bars
GannMax = HHV(GannValue, NormPeriod)
GannMin = LLV(GannValue, NormPeriod)

If (GannMax > GannMin) Then
GannNorm = 2 * ((GannValue - GannMin) / (GannMax - GannMin)) - 1
Else
GannNorm = 0
End If

' 100-bar high and low of price
PriceHigh100 = HHV(H, HLPeriod)
PriceLow100 = LLV(L, HLPeriod)

Plot("NormGann", GannNorm)
Plot("High100", PriceHigh100)
Plot("Low100", PriceLow100)

Return GannNorm

###########################################

You need to declare parameters and variables, then compute the normalized Gann value (GannNorm) and the 100-bar price high/low. HHV(GannValue, NormPeriod) and LLV(GannValue, NormPeriod) find the recent high/low of the Gann series; then scale (GannValue – GannMin)/(GannMax – GannMin) to [–1,1].

Separately, HHV(H,100) and LLV(L,100) give the 100-bar highest high and lowest low of the price. Finally use Plot(...) to display the normalized oscillator and the price high/low lines.

This OmniLanguage code can be placed in a System or Indicator in OmniTrader to produce the desired outputs, with values consistently scaled between –1 and +1 and the 100-bar price range plotted.

Let me know how you go with this or if you have any questions around these suggestions.

Cheers Etherist

[Edited by Etherist on 5/30/2025 6:28 PM]

^ Top
Lou Venezia

Member
25
Posts: 25

Joined: 7/22/2022

User Profile
 
Subject : RE: Omnilanguage Hi/Lo Question
Posted : 6/1/2025 12:13 PM
Post #32529 - In reply to #32230

Hey Eterist - Good to hear from you, it's been a while. I had been unsuccessful in getting any responses from the forum and Nirvana so I put the project on the back burner. I very much appreciate your reply with a potential solution for my project. I'm excited to test it out and will let you know my results. Thanks again - I appreciate your interest and help.
^ Top
Etherist

Member
25
Posts: 27

Joined: 6/9/2024
Location: South Australia

User Profile
 
Subject : RE: Omnilanguage Hi/Lo Question
Posted : 6/2/2025 5:30 AM
Post #32531 - In reply to #32230

Hello again there Lou

I had a closer look at your question, specifically the "calculate the 100 day high and 100 day low of the calculated result" aspect and suggest the following change to the Indicator, so that you are using the calculated Gann result and not the Price:

##############################################

#Indicator
#PARAM "NormPeriod",100,1,1000
#PARAM "HLPeriod",100,1,1000

Dim GannValue As Double
Dim GannMax As Double
Dim GannMin As Double
Dim GannNorm As Double
Dim High100 As Double
Dim Low100 As Double

' Example Gann calculation (replace with your actual formula)
GannValue = (H + L + C) / 3

' Normalize Gann result over NormPeriod bars
GannMax = HHV(GannValue, NormPeriod)
GannMin = LLV(GannValue, NormPeriod)

If (GannMax > GannMin) Then
GannNorm = 2 * ((GannValue - GannMin) / (GannMax - GannMin)) - 1
Else
GannNorm = 0
End If

' Now calculate the 100-bar high and low of the Gann result (not price)
High100 = HHV(GannValue, HLPeriod)
Low100 = LLV(GannValue, HLPeriod)

Plot("NormGann", GannNorm)
Plot("High100", High100)
Plot("Low100", Low100)

Return GannNorm

##########################################

Hope this more closely matches your needs ... Cheers again :-)


^ Top
Lou Venezia

Member
25
Posts: 25

Joined: 7/22/2022

User Profile
 
Subject : RE: Omnilanguage Hi/Lo Question
Posted : 6/13/2025 12:42 PM
Post #32533 - In reply to #32230

Hey Etherist - thanks again. I've been away for a few weeks but am back and will try your solution. I'll let you know how it turns out.

Thanks again.
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.