Current location | Thread information | |
![]() ![]() ![]() ![]() ![]() ![]() |
Last Activity 7/6/2025 3:47 AM 14 replies, 8724 viewings |
|
|
Printer friendly version |
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
Looking for coding assistance for the Awesome Oscillator which is not part of OmniTrader yet. The definition is: "The Awesome Oscillator shows the difference between a 5-period Moving Average and a 34-period Moving Average, both calculated for the midpoints of the candles, (High+Low)/2." It is a unique indicator which reflects the tendencies in the market. I hope to paste it into OmniTrader and have it become an indicator. Thanks, JSmish | ||
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
I should add that the resulting indicator consists of red or green bars moving above and below a mid line. I've watched the chart pattern trader use this for the past few weeks and it has been spot on! | ||
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
Here's the link for a full description. http://www.actfx.com/Download50013.aspx | ||
^ Top | |||
jawjahtek![]() Member ![]() Posts: 37 Joined: 5/30/2006 Location: Georgia, USA ![]() |
Actually, this is just a version of MACD using SMAs and the Median Price. Here is Nirvana's code for MACD, modified as needed. Good luck to you; I would not consider this indicator "awesome" or "spot on", and I would not expect N to include it in OT. #Indicator #PARAM "ShortPeriods", 5 #PARAM "LongPeriods", 34 Dim fMACDao as Single fMACDao = SMA((H+L)/2, ShortPeriods) - SMA(H+L)/2, LongPeriods) Plot("MACDao", fMACDao) Return 0 | ||
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
Thank you. I created the omni language indicator using the code provided but only the name AwesomeOscillator appears on the chart template. JSmish | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Try this - adds if/then for warmup delay, necessary when a complex argument is used with a called function like SMA: #Indicator #PARAM "ShortPeriods", 5 #PARAM "LongPeriods", 34 Dim fMACDao as Single if bar > LongPeriods then fMACDao = SMA((H+L)/2, ShortPeriods) - SMA(H+L)/2, LongPeriods) Plot("MACDao", fMACDao) end if Return fMACDao [Edited by Jim Dean on 11/14/2012 11:01 AM] | ||
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
Same thing. Compilation pointed out line 9 has too many closing parenthesis. When editing the indicator in chart options, there is only one line not two. | ||
^ Top | |||
SteveL![]() Veteran ![]() ![]() Posts: 133 Joined: 2/15/2007 Location: Boulder, CO ![]() |
A left paren is missing in the "fMACDao =" statement. Here is the corrected statement with balanced parenthesis: fMACDao = SMA((H+L)/2, ShortPeriods) - SMA((H+L)/2, LongPeriods) | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Thx Steve ... since no error was mentioned initially I did not look at it closely enuf. Your fix should do it. | ||
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
TaDah! Thanks again. Anyway to have it look like a macd hist with bars above and below 0? | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
Use Plothist("MACDao", fMACDao, 0) | ||
^ Top | |||
JSmish![]() Member Posts: 8 Joined: 11/13/2012 Location: Castle Rock, CO ![]() |
Great, thanks again! | ||
^ Top | |||
Jim![]() New User Posts: 2 Joined: 10/27/2014 Location: Saint Louis, MO ![]() |
Hi, Does anyone have a reference for how to plot a color change code for this histogram? If the current bar is greater than the previous bar, then plot green If the current bar is less than the previous bar, then plot red. Thanks, Jim #Indicator #PARAM "ShortPeriods", 5 #PARAM "LongPeriods", 34 Dim fMACDao as Single if bar > LongPeriods then fMACDao = SMA((H+L)/2, ShortPeriods) - SMA((H+L)/2, LongPeriods) Plothist("MACDao", fMACDao, 0) end if Return fMACDao | ||
^ Top | |||
Jim Dean![]() Sage ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3433 Joined: 3/13/2006 Location: L'ville, GA ![]() |
#Indicator #PARAM "ShortPeriods", 5 #PARAM "LongPeriods", 34 Dim fMACDao as Single if bar > LongPeriods then fMACDao = SMA((H+L)/2, ShortPeriods) - SMA((H+L)/2, LongPeriods) If fmacdao > fmacdao[1] then Plothist("MACDao", fMACDao, 0, green) Else Plothist("MACDao", fMACDao, 0, red) End if end if Return fMACDao | ||
^ Top | |||
Jim![]() New User Posts: 2 Joined: 10/27/2014 Location: Saint Louis, MO ![]() |
Thanks, it works perfect |
|
|
Legend | Action | Notification | |||
Administrator
Forum Moderator |
Registered User
Unregistered User |
![]() |
Toggle e-mail notification |