NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-10-2007, 04:55 AM   #1
tquinn
Senior Member
 
Join Date: Jan 2005
Location: , ,
Posts: 109
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

I seem to be Thick Headed on this topic. I want an indicator, say MACD, where the Diff, plotted as bars, changes colors.

The idea is

if this bar > bar[1] then make (this bar) green else make it red

I've tried placing the Plots[2].Min=Diff[1] in the OnBarUpdate() method, thinking this would set the thresholds by comparing to the previous bar value.

It compiles and plots, but it still changes all history bars based on the current evaluation. I don't want to change the history, just the Current bar.

I know there is something simple I'm missing , just need some guidance I guess.
tquinn is offline  
Reply With Quote
Old 01-10-2007, 05:26 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

A plot in NinjaScript can only have one color at any given moment. They can not have dual colors.

Therefore, to implement what you want, you have to have two plots, and only show the plot that you want based on the condition you specify.

The attached sample indicator does exactly what you want. This indicator uses the DataSeries.Reset() method which is not working in NT6 Beta 5 right now.
Ray
Attached Files
File Type: zip MDiff.zip (1.5 KB, 50 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-10-2007, 05:26 AM   #3
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

The sample indicator will generate the following output.


Attached Images
File Type: jpg ES 03-07 1_10_2007 (1 Min).jpg (45.5 KB, 109 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-10-2007, 05:53 AM   #4
tquinn
Senior Member
 
Join Date: Jan 2005
Location: , ,
Posts: 109
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

OK, thanks, I'll study this this tonight. Maybe my thick head can get softened up a bit.
tquinn is offline  
Reply With Quote
Old 03-01-2010, 06:11 AM   #5
subterfuge
Senior Member
 
Join Date: Nov 2008
Posts: 117
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi.
I tried to import Mdiff but i got the following error.

''archive was not exported by ninjatrader or its contents have been manipulated.''

any help?
thanks
subterfuge is offline  
Reply With Quote
Old 03-01-2010, 06:20 AM   #6
NinjaTrader_Tim
NinjaTrader Customer Service
 
NinjaTrader_Tim's Avatar
 
Join Date: Nov 2009
Location: Denver, CO
Posts: 1,424
Thanks: 0
Thanked 3 times in 3 posts
Default

Hi subterfuge,

Thank you for your post.

Unfortunately, it seems that was exported using a much older version of NinjaTrader, and cannot be imported using the current version.

However, here is a page from out Help Guide that demonstrates the same concept in a tutorial.
http://www.ninjatrader-support.com/H...tml?Overview25
NinjaTrader_Tim is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 04:36 PM.