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
Help with making system out indicator.
Last Activity 7/6/2025 3:47 AM
2 replies, 2613 viewings

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

^ Top


This accout has been deleted
 
Subject : Help with making system out indicator.
Posted : 1/26/2015 12:53 PM
Post #23318

I modified a stochastic momentum indicator by Mel Dickover by adding a signal line and using the original formula by Blau. Since I no experience with programming, I was amazed that it works just like the TOS platform indicator. I want to make a system that produces a long signal when the SMI line crosses above signal line and vice versa for the short signal. I also wanted to produce code to do the same in omniscan. Unfortunately, as this indicator is coded, I have no idea how to do this. I don't know how to access "SMI" to write a crossover with the EMA(3) of the SMI. Any nudges in the right direction would be greatly appreciated. Indicator code listed below:

#Indicator
'MySMI
'Stochastic Momentum Index indicator
'with signal line
'Based off initial indicator, SMI
' Coded by Mel Dickover April 2012
'------------------------------------------
#param "lookback", 5
#param "thresholdLong",-80
#param "thresholdShort",+80

dim temp1, temp2, temp3, temp4, temp5, temp6 as single
dim x as single
dim y as single

temp1 = (HHV(H,lookback)+LLV(L,lookback))*0.5 ' C
temp2 = C[0] - temp1 ' D
temp3 = EMA(temp2,3) 'DS1
temp4 = EMA(temp3,3) 'DS2
temp5 = EMA((HHV(H,lookback) - LLV(L,lookback)),3) 'DHL
temp6 = ema(temp5*0.5,3) 'DHL2
x = 100*(temp4/temp6)
y = EMA(x,3)

plot("SMI",x)
plot("Signal line",y)
plot("Thresholdlong",thresholdLong)
plotLabel(thresholdLong)
plot("Thresholdshort",thresholdShort)
plotLabel(thresholdshort)

Return x ' Return the value calculated by the indicator
Return y ' Return the value calculated by the signal line


Attached file : mySMI.PNG (111KB - 404 downloads)

^ Top
Jim Dean

Sage
2000100010010010010025
Posts: 3433

Joined: 3/13/2006
Location: L'ville, GA

User Profile
 
Subject : RE: Help with making system out indicator.
Posted : 1/26/2015 1:35 PM
Post #23319 - In reply to #23318

Here is a quick and dirty solution ... first, a mod to the Indicator so you can use it in an OScan ... the Return value will be +1 when SMI is greater than its EMA(3), and will be -1 when it's less than the EMA(3) ... OmniScan formula would be MySMI(lookback,-80,80) > 0 for long, or < 0 for short. Note that this is an extended STATE, not a single bar EVENT (system uses event):

#Indicator
'MySMI
'Stochastic Momentum Index indicator
'Returns +1 or -1 if above or below signal line
'Based off initial indicator, SMI
' Coded by Mel Dickover April 2012
'------------------------------------------
#param "lookback", 5
#param "thresholdLong",-80
#param "thresholdShort",+80

dim temp1, temp2, temp3, temp4, temp5, temp6 as single
dim x as single
dim y as single

temp1 = (HHV(H,lookback)+LLV(L,lookback))*0.5 ' C
temp2 = C[0] - temp1 ' D
temp3 = EMA(temp2,3) 'DS1
temp4 = EMA(temp3,3) 'DS2
temp5 = EMA((HHV(H,lookback) - LLV(L,lookback)),3) 'DHL
temp6 = ema(temp5*0.5,3) 'DHL2
x = 100*(temp4/temp6)
y = EMA(x,3)

plot("SMI",x)
plot("Signal line",y)
plot("Thresholdlong",thresholdLong)
plotLabel(thresholdLong)
plot("Thresholdshort",thresholdShort)
plotLabel(thresholdshort)

if x > y then
Return 1 ' bullish state
elseif x < y then
Return -1 ' bearish state
else
Return 0
end if



To make a system out of it, modify the code at the end and change the #Indicator at the start to #System and save it in the VBA\Systems folder:

#System
'MySMI
'Stochastic Momentum Index system creates
'Long/Short signal when crossover/under
'Based off initial indicator, SMI
' Coded by Mel Dickover April 2012
'------------------------------------------
#param "lookback", 5
#param "thresholdLong",-80
#param "thresholdShort",+80

dim temp1, temp2, temp3, temp4, temp5, temp6 as single
dim x as single
dim y as single

temp1 = (HHV(H,lookback)+LLV(L,lookback))*0.5 ' C
temp2 = C[0] - temp1 ' D
temp3 = EMA(temp2,3) 'DS1
temp4 = EMA(temp3,3) 'DS2
temp5 = EMA((HHV(H,lookback) - LLV(L,lookback)),3) 'DHL
temp6 = ema(temp5*0.5,3) 'DHL2
x = 100*(temp4/temp6)
y = EMA(x,3)

plot("SMI",x)
plot("Signal line",y)
plot("Thresholdlong",thresholdLong)
plotLabel(thresholdLong)
plot("Thresholdshort",thresholdShort)
plotLabel(thresholdshort)

if x > y and x[1] <= y[1] then
Signal = LongSignal
elseif x < y and x[1] >= y[1]then
Signal = ShortSignal
end if



[Edited by Jim Dean on 1/26/2015 5:13 PM]

^ Top


This accout has been deleted
 
Subject : RE: Help with making system out indicator.
Posted : 1/26/2015 5:09 PM
Post #23320 - In reply to #23318

Jim,
Thank you! Thank you! Thank you! I still have some hair left before pulling it all out. It worked nicely. For omniscan, I added the condition:
MySMIMODIFIED(5,-80,80) > 0 AND
MySMIMODIFIED(5,-80,80)[1] < 1
which gives me the crossover signal I needed.
You have just given me back at least an hour a day in preparation time.
Much gratitude for your help.
Paul
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.