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.

 
Matthew Greenslet

Idol
2000252525
Posts: 2077

Joined: 2/27/2006

User Profile
 
Subject : RE: Base OT2009 Formulas
Posted : 1/5/2009 3:01 PM
Post #11104 - In reply to #10768

If you are changing the SMA the only line you need to change is

fSMA = Sum(Periods)/Periods

More specifically the Sum function. Just like with most other function calls it uses the close price as the default value. As pointed out in the FAQ I mentioned earlier most function calls have an 'overload' or a second way to call it. This overload will allow you to specify the values to use for the calculations. So you could change it to

fSMA = Sum(H, Periods)/Periods
or
fSMA = Sum(L, Periods)/Periods
or
fSMA = Sum(O, Periods)/Periods

If you wanted to make it fancy you could add a parameter that allows you to dynamically choose the value.

#Indicator
#PARAM "Periods", 14
#PARAM "PriceField", 2, 1, 4
Dim fPrice, fSMA as Single

If PriceField = 1 Then
fPrice = O
ElseIf PriceField = 2 Then
fPrice = H
ElseIf PriceField = 3 Then
fPrice = L
ElseIf PriceField = 4 Then
fPrice = C
End If

fSMA = Sum(fPrice, Periods)/Periods
PlotPrice("SMA", fSMA)
Return fSMA
Deleting message 11104 : RE: Base OT2009 Formulas


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