PDA

View Full Version : Stoch Momentum Indicator


Angel
12-12-2007, 12:11 PM
Hello all,

Is there anybody on this board able to translate the SMI :

Stochastic Momentum Indicator by William Blau. The result is an oscillator that ranges between +/- 100 and is a bit less erratic than an equal period Stochastic Oscillator. While similar to the Stochastic Oscillator, the SMI displays where the close is relative to the midpoint of the recent high/low range, as compared to the close relative to the recent high/low with the Stochastic Oscillator. This results is an oscillator that ranges between -100 and +100 and can be a bit less erratic than an equal period Stochastic Oscillator.


An example formula (see Stochastic Momentum Index) illustrates the calculation of the Stochastic Momentum Index. When the close is greater than the midpoint of the range, the SMI is positive. When the close is less than the midpoint of the range, it is negative. The interpretation of the SMI is virtually identical to the Stochastic Oscillator.

Stochastic Momentum Indicator

100 * ( Mov( Mov(C - (.5 * ( HHV(H,13) + LLV(L,13))),25,E),2,E)/
(.5*Mov(Mov( HHV(H,13) - LLV(L,13),25,E),2,E)))

Many thanks for your attention,

Happy trading

Cheers

Angel

Angel
12-13-2007, 05:09 AM
Hello,

This is below the Easy Language code for the SMI, it would be so kind if someone could translate it in NT code. Sincerely, adding the SMI in our trading arsenal would be an edge !!!

Thanks for your careful attention,

Happy trading,

Cheers

Angel

.................................................. .................................................. ....

Type : Function, Name : SMI

input:
length1(NumericSimple),
length2(NumericSimple),
length3(NumericSimple);

var:
HH(0),
LL(0);

HH = Highest(H,length1);
LL = Lowest (L,length1);

SMI = 100 * (XAverage(XAverage(C-(0.5*(HH+LL)),length2),length3) /
(0.5 * XAverage(XAverage(HH-LL,length2),length3)));

.................................................. .................................................. ...

Type : Indicator, Name : SMI

input:length1(13),length2(25),length3(2),alertLeve l(40);

plot1( smi(length1,length2,length3), "SMI" );
plot2( alertLevel, "sell line" );
plot3(-alertLevel, "buy line" );

if plot1 crosses above -alertLevel then
alert("SMI crosses above buy line");

if plot1 crosses below alertLevel then
alert("SMI crosses below sell line");

mwyatt
12-16-2007, 11:27 PM
So, i put this together but am not sure if it is correct, as i have nothing to compare against. Some comments please? Or if someone would like to make some code adjustments, please do.

cheers
Mat

mahlonhersh
10-20-2008, 09:26 PM
Doesn't look like this indicator works. It didn't show any data for me.

Thanks,

Mahlon

NinjaTrader_Jason
10-21-2008, 03:35 AM
Hi Mahlon,

I tested the indicator on my end and it plotted data as you can see in the screenshot.

I suggest to delete the indicator via Tools-->Edit NinjaScript-->Indicator.

Re-import the indicator and check if it will plot data. If not, please check the Log-tab for any error messages.

mahlonhersh
10-21-2008, 08:22 AM
Jason,

Thanks for your help. I followed your suggestion and it worked great.

Mahlon

bluejay
11-12-2008, 01:40 PM
Hi Jason,

this indicator looks great, but one problem is : it works on some instruments (eg FDAX), but not with others (eg ES)

any hints what's the matter ?

thanks in advance

bluejay

NinjaTrader_Josh
11-12-2008, 01:55 PM
Hi bluejay,

This is not an indicator we made. You want to contact the original author, mwyatt.

mni4tw
12-07-2008, 09:23 AM
the smi indicator doesnt draw anything in my chart. (just empty)

any suggestion/help?

in the log it says "DefaultError on plotting indicator 'StochasticMomentumIndex'. Please check the 'OnBarUpdate' or the 'Plot' method: Overflow error."

NinjaTrader_Ray
12-07-2008, 02:00 PM
You would have to debug or ask the original author to do so.

GorSvet
12-09-2008, 04:05 PM
Here is another version of Stochastic Momentum Index which doesn't get an Overflow error. I tested it against Thinkorswim built-in SMI indicator.

Drakmyre
12-09-2008, 09:31 PM
Hey Everyone,

Does anyone know how to set this to a 20/80 setting instead of -40/40?

Elliott Wave
12-09-2008, 09:54 PM
http://shup.com/Shup/91348/smi.jpg

You can also edit the script and in the initialize section change the line values.

Drakmyre
12-09-2008, 10:05 PM
Hey EW,

The lines still plot normally. Is there a way to change this?

Elliott Wave
12-09-2008, 10:46 PM
Its working fine for me here, unless I'm misunderstanding your problem.

Drakmyre
12-09-2008, 11:23 PM
EW,

It works. It's just that I have a bunch of RSI and 80/20 indicators in the same frame and I want to adapt the Stoch Momentum Indicator to it.

mni4tw
12-15-2008, 11:26 AM
thx for posting the new working indicator(StochasticMomentumIndexn.cs), but how do i import the new cs into ninja trader?

(i can only choose to import zip files under files -> utilities -> import)

Elliott Wave
12-15-2008, 11:56 AM
thx for posting the new working indicator(StochasticMomentumIndexn.cs), but how do i import the new cs into ninja trader?

(i can only choose to import zip files under files -> utilities -> import)


Copy the .cs file to your 'My Documents\NinjaTrader 6.5\bin\Custom\Indicator' folder, then go to 'Tools>Edit NinjaScript' (doesn't matter which one you select) and then select compile at the top of the NinjaScript editor.

mni4tw
12-16-2008, 07:10 PM
thx. it works now!

rtj4201
01-11-2009, 01:58 PM
I did what Elliot Wave suggested. Added the .cs file and compiled the program. I loaded the indicator but it is blank. What am I doing wrong?

NinjaTrader_Ray
01-11-2009, 03:03 PM
Likely you do not have enought data or your indicator generated an error in which case you woudl need to debug it to fix it. Check the Control Center Log tab after applying the indicator to a chart for any related error messages.

rtj4201
01-11-2009, 03:19 PM
You are right. There were error messages. I did a print screen. Attached is the log file. I think file is attached. it said it was.

rtj4201
01-11-2009, 06:01 PM
Not sure what I did but it now works. Thanks for input.

pedroprada@bellsouth.net
01-12-2009, 04:42 PM
I would really like to have this indicator available but do not have the compile function on my NT version.

Can someone post the zip file here for easy import of this indicator?

Thanks for your help and great work!

rtj4201
01-13-2009, 12:53 PM
I have been using the indicator now for a few days on futures.

I decided to try a US stock.

The indicator loads but the lines do not plot.

Anyone know what I am doing wrong?

NinjaTrader_Jason
01-13-2009, 12:56 PM
Please ensure you have enough price bars listed in the chart for the indicator to calculate its value.

rtj4201
01-13-2009, 01:25 PM
I am using the same chart that was displaying the futures contract. I did not modify the chart.

NinjaTrader_Josh
01-13-2009, 01:35 PM
rtj4201,

Please ensure you have enough data on this chart. Since this is a 3rd party indicator I cannot offer much more support.

Ensure you have data on the chart.
Ensure your script is installed via compiling it successfully.
Ensure there are no errors in your Control Center.

rtj4201
01-13-2009, 02:04 PM
I scrolled back and I am getting data back to 12/2/8.

NinjaTrader_Josh
01-13-2009, 02:07 PM
Please check all the other items too.

rtj4201
01-13-2009, 05:07 PM
I checked all items.

1. Data is on the chart. Futures and stocks
2. Recompiled script, again. It says sucessful. No error logs.
3. No errors in control panel log is I run a Future Contract.
If I run a stock I get the following:

"Error on plotting Indicator" StochasticMomentumIndex". Please check the 'onbarupdate' or the 'plot' method. Overflow error."

I am attaching the file used to compile. If you have time to look at it I would appreciate it.

Ralph
01-14-2009, 01:22 AM
Hi rtj4201,

that kind of error message is delivered when a runtime exception occures. I suspect a variable was overflowing (illegal calculation result, too many increments). Have a look at the trace-file in the NT trace directory. Usually you could find there a stack report describing the exception in more detail.

Regards
Ralph

rtj4201
01-14-2009, 04:45 AM
I am new to Ninjascript. I will get there. But I haven't studied it enough to find the information that you have noted. Is there anyway you could be a little more detailed so I can find a way to begin?

NinjaTrader_Jason
01-14-2009, 04:51 AM
Hello rtj4201,

I suggest to take a look at the forum thread below that addresses a similar issue.
http://www.ninjatrader-support2.com/vb/showthread.php?t=10679&highlight=Overflow+error

More information regarding debugging NInjaScript code can be found at the following link.
http://www.ninjatrader-support2.com/vb/showthread.php?t=3418

Ralph
01-14-2009, 04:58 AM
Yes, follow Jason's links they give you some guidance regarding the debugging process. And have a look at the trace file of the day when the exception occured. You find these files in the 'trace'-directory of the NT installation, one trace file for every trading day.

Regards
Ralph

rtj4201
01-14-2009, 08:25 AM
Doesn't it seem odd that the indicator works just fine for Futures contracts and does not work for stocks.

What does that indicate?

NinjaTrader_Jason
01-14-2009, 08:33 AM
I tested the custom indicator on my end on a AAPL 1 minute chart and the indicator plotted on my end.

I suggest to delete the indicator and re-import it and check if this will make a difference.

brain77
01-14-2009, 08:45 AM
hi, it also happens to me that this indicator doesnt plot.
this happens in some futures. its not only to you, rtj4201 !

NinjaTrader_Josh
01-14-2009, 08:51 AM
It is evident there is a bug with the indicator. It may be best for you guys to try and come into contact with the original author of the indicator. Unfortunately we cannot provide any support for this 3rd party indicator.

rtj4201
01-14-2009, 09:33 AM
Ok, I will try and work thru the original submitter. By the way, I have reloaded and recompiled this thing a number of times.

The first time, even the Futures would not work, then the Futures started working.

Oh, well.

Chartsky
02-09-2009, 02:20 PM
I would really like to have this indicator available but do not have the compile function on my NT version.

Can someone post the zip file here for easy import of this indicator?

Thanks for your help and great work!

All I had to do was open the indicator after it was moved (Tools>Edit Ninjascript>Indicator) select StochasticMomentumIndex to open it and then right-click anywhere inside the text. That gave the compile option in a drop-down menu.

Tasuki
03-22-2010, 12:17 AM
I suggest to delete the indicator via Tools-->Edit NinjaScript-->Indicator.



Jason,
I'm trying to follow your instructions to delete this indicator (since it doesn't work for me), but when I go to "Tools", I see no "Edit Ninjascript" option (I'm using NT version 6.5.1000.14). Instead, all I see is:

Tools
Instrument Manager
Historical Data
Account Connections
Options

Where is the "Edit Ninjascript" or is this command on an earlier or later version of Ninja?
Thanks, Tasuki

NinjaTrader_Jason
03-22-2010, 04:16 AM
Hello Tasuki,

You must have a license entered at Help-->License Key that does not allow the use of NinjaScript.

Please send me an email at support[at]ninjatrader[dot]com and reference this forum thread. I will provide you the free license key that will allow you to access Edit NinjaScript.

eDanny
03-22-2010, 07:47 AM
TOS version here.

http://www.ninjatrader-support2.com/vb/showthread.php?p=153330#post153330

Tasuki
03-23-2010, 11:58 AM
Forgive my igorance (:))
What does TOS stand for? Just curious.
Tasuki


TOS version here.

http://www.ninjatrader-support2.com/vb/showthread.php?p=153330#post153330

rtj4201
03-23-2010, 08:17 PM
I think they are referring to Think or Swim TOS brokers.