NinjaTrader Support Forum  

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 07-19-2007, 01:05 AM   #1
recentrage
Junior Member
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Problem with close[0] and close[1]

Dear traders,

I need some help with close[0] and close[1].

When I DO

set.plot(close[0] > open[0]?1:0)

I have my new plot, all is ok !

But when I do

set.plot(close[0] > close[1]?1:0)

I have nothing - a blank chart !

What can I do to create an indicator witch says "1" if close > close[1].

Thanks and regards,

David
recentrage is offline  
Reply With Quote
Old 07-19-2007, 02:14 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

You will find the problem in your logs.

To fix you'll need to add code like this:
Code:
if (CurrentBar < 1)
   return;
before you accessed Close[1].
NinjaTrader_Dierk is offline  
Reply With Quote
Old 07-19-2007, 08:51 AM   #3
recentrage
Junior Member
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default Thanks Now

Dear Dirk,

It's Ok now, thanks.

But what does it mean ?

Regards

David
recentrage is offline  
Reply With Quote
Old 07-19-2007, 08:54 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Please see here: http://www.ninjatrader-support.com/H...urFormula.html
NinjaTrader_Dierk is offline  
Reply With Quote
Old 07-19-2007, 08:55 AM   #5
recentrage
Junior Member
 
Join Date: Jul 2007
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Ok, thanks a lot !

David
recentrage 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bar Close / Open timing Kardinal Charting 2 07-06-2007 08:06 AM
buy/sell at close of bar? coffee898 Charting 4 03-20-2007 03:55 AM
Open position on close down andrewedmondson ATM Strategies (Discretionary Trading) 3 10-05-2005 07:02 AM
Canel or Close scjohn Automated Trading 3 06-21-2005 12:06 AM
Limit on close gdargento Suggestions And Feedback 1 04-08-2005 06:33 AM


All times are GMT -6. The time now is 05:18 PM.