![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2012
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi All,
Does anyone have a Last Close Price - SMA indicator they would recomend. I am new to NT. Thank you in advance for any suggestions or thoughts. Regards, Art |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
Hello,
The default SMA will give you the value based off the Close price. Does this indicator not offer what you are looking for?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jul 2012
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Matt,
I am looking for the difference between the Close and SMA. ie. Close = 100 SMA = 95 I am looking for the value +5 Similarly Close = 85 SMA = 95 I would be looking for the value -10 As far as I can tell there isn't a parameter in the built-in SMA to do this calculation. Thanks |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
Thanks for the clarification.
Believe the attached will do what you're looking for.
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jul 2012
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Matt,
This was exactly what I was looking for. Thank you. I tried to load this as a column in the Market Analyzer, however the analyzer is leaving that row blank for all stocks I tried. Is there another setting or flag I need to check/select? Is there something about this custom indicator that won't let me use it in the Market Analyzer? Thanks |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
Hello,
This should work int he market analyzer. Are you sure you have the Plot set to Plot0? What data series do you have the indicator applied to? Is it a minute, tick or daily interval? Who is your data provider?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jul 2012
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Matt,
You got it. It was the Plot0 on the Close indicator. A final question I hope. Am I calculating different things? Doing the math I see that for AAPL, the Last Price Column (585.16) minus the 10 period SMA (597.88) should equal -12.72. Shouldn't this be the same thing that the ClosePriceSMA(10) custom indicator is calculating? Instead the ClosePriceSMA(10) column is showing -12.43. What am I missing? I have attached a word doc with screen shots of my column and indicator setups. Thank you as always. You've been terrific. |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
Hello,
You're doing the math right and those are for sure not the correct values. This indicator simply takes the Close of the current bar and subtracts the Sma period. I'm curious about the last price column you have - can you please clarify who you use as your data provider? If you add in another column using a 1 period SMA with calculate on bar close = false, does the 1 Period SMA match the LastPrice column?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jul 2012
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Matt,
My data provider currently is setup as Yahoo!. I added the SMA(1) colum you suggested and it matched the value of my Last Price column. Ironically, the SMA(10) value - Last Price value = the ClosePrice indicator value, as it should have. I did have to recreate the Market Analyzer layout as I didn't save it previously. Bottom line, it looks as if it is working, any idea what I was doing incorrectly? Do you think that the last price or SMA(10) was setup incorrectly? Thanks again for your help. I've attaced a screenshot of the Market Analyzer. Art |
|
|
|
|
|
#10 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,794
Thanks: 160
Thanked 568 times in 559 posts
|
Art,
I'm not totally sure why that wasn't work for you earlier, but I'm glad to see they are working now. I'd suggest keeping an eye on the 1 period SMA to see if you ever run into a case where that does not match your last price. You can always right click on the market analyzer and select reload historical data to update the values.
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Jul 2012
Posts: 11
Thanks: 0
Thanked 0 times in 0 posts
|
Matt,
Thank you sir. You've been great. Very helpful and timely in your responses. Best, Art |
|
|
|
![]() |
| Tags |
| indicator, sma |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SMA Greater than Close | Hockey_Mike | Market Analyzer | 5 | 07-27-2012 10:36 AM |
| Discrepancy between plotted SMA and Indicator SMA? | Bogomir28 | Indicator Development | 2 | 03-24-2012 03:49 PM |
| indicator to plot the 50 period sma of the 5 sma | brdnickel | NinjaScript File Sharing Discussion | 6 | 01-26-2011 01:03 PM |
| Close price not ZivalueCharts close price plot in the market analyzer | randomwalker | Market Analyzer | 1 | 05-22-2010 06:39 PM |
| Comparing Close to SMA value failing - why? | Iggy22 | General Programming | 2 | 04-19-2008 12:47 AM |