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.


[Random Quote] -


This message cannot be deleted. It is the first message of the thread.
Administrators or moderators may choose to delete the entire thread


 
Matthew Greenslet

Idol
2000252525
Posts: 2077

Joined: 2/27/2006

User Profile
 
Subject : How to Reference Historical Values
Posted : 10/8/2007 4:02 PM
Post #6854

Q: How can I get a historical value of price data or an indicator?

A:

A very important concept when writing indicators, systems, and stops is the ability to reference a historical value of price data or indicators. You can do this in OmniLanguage through the use of a look back parameter appended to the end of any function call. This look back parameter is used in the format of [5]. The number within the brackets is the number of bars back you want to reference, and in this case would be 5 bars back. You can use any number you like (within reason). If you try to look back more than the number of bars on the chart it will return the very first value.

Here are some of the function calls you maybe already familiar with

O - Returns the Open Price
H - Returns the High Price
L - Returns the Low Price
C - Return the Close Price
EMA(14) - Returns the value of a 14 period EMA

Anytime you call a function it will return the most current value unless you use a look back. For example if you want to know the value of yesterdays (assuming a daily chart) 14 period EMA you would use

EMA(14)[1]

This will return the value of the 14 period EMA of 1 bar back.
One example that would make use of historical values would be any crossover system.

http://www.omnitrader.com/omnitrader/proforum/thread-view.asp?threadid=1289&posts=1

[Edited by Matthew Greenslet on 11/5/2007 1:42 PM]

Deleting message 6854 : How to Reference Historical Values


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