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 08-01-2007, 12:10 PM   #1
Richard Von
Member
 
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
Default Volume Bar Times

I have written an indicator to create a bar chart of the time durations of each bar (or average over several bars) to use with volume charts (and would probably work for tick charts). This time duration would give a way to watch the speed to volume for constant volume charts.

The indicator compiles fine but nothing shows up on my charts. I think the time calculations are right, but think I am not specifiying the plot correctly.

Please help.
Attached Files
File Type: cs vWBarTimes.cs (6.2 KB, 17 views)
Richard Von is offline  
Reply With Quote
Old 08-01-2007, 01:07 PM   #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
Default

If an indicator is not working as expected, see your Log tab for errors. Looking at your code, you are accessing Time[Periods] which for sure will throw an error since you need to make sure you have enough bars on your chart.

Add something like:

if (CurrentBar < Periods)
return;
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-01-2007, 02:02 PM   #3
Richard Von
Member
 
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks, that got it working great. I know you told me this before and it is sinking in.
Richard Von is offline  
Reply With Quote
Old 08-03-2007, 06:13 AM   #4
Richard Von
Member
 
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
Default Final code

In response to a request, I am posting my final indicator code for the Volume Bar Times. Note that the horizontal line level is a personal choice that can be changed in the code.

It will run as named, but if renamed, all instances of the name must be changed or the code won't work.

Hope someone else finds this useful.

Richard v W.
Attached Files
File Type: cs vWBarTimes.cs (6.7 KB, 54 views)
Richard Von is offline  
Reply With Quote
Old 09-04-2007, 11:22 AM   #5
maxpi
Senior Member
 
Join Date: Jun 2007
Posts: 151
Thanks: 0
Thanked 0 times in 0 posts
Default Importing the code...

NT wants to import only zipped files of some sort, how best to get this code into my setup? I tried making a new indicator of the same name and copying/pasting and ran into troubles.
maxpi is offline  
Reply With Quote
Old 09-04-2007, 11:24 AM   #6
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
Default

Save the .cs file in the following folder:

My Documents\NinjaTrader 6\bin\custom\indicator

Then open up this file via Tools > Edit NinjaScript and compile.
NinjaTrader_Ray 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
Times & Sales NinjaTrader_Josh Suggestions And Feedback 1 07-19-2007 06:11 AM
plotting pit times knightrider123 Charting 1 06-26-2007 07:04 AM
Trading Times latkinso Automated Trading 1 06-15-2007 12:23 PM
two symbols have different bar times Folls Strategy Development 4 05-17-2007 06:42 AM
Start & end times for FOREX bmaltz Charting 3 05-02-2007 04:50 PM


All times are GMT -6. The time now is 05:03 AM.