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 08-24-2007, 12:59 PM   #1
Richard Von
Member
 
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
Default Markers in Indicator Panels

I want to draw markers (Diamonds, arrows, squares) in an indicator panel(like MACD) upon certain conditions. I can successfully find the conditions and make a sound play, but cannot make any marker appear in the MACD panel. I have been able to use similar conditions and make markers appear in the price panel.

I am putting the right panel number when I set up the indicator but no joy.

For example, I've tried:

string myTag = "myTag" + TagNbr.ToString();
DrawDiamond(myTag, 0, MACD(Fast,Slow,Smooth)[0] + .01, Color.Red);
TagNbr = TagNbr + 1;

Nothing appears. Can this be done?
Richard Von is offline  
Reply With Quote
Old 08-24-2007, 01:04 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

Yes, this can be done. You have to set the following property in your custom indicator's Initialize() method:

DrawOnPricePanel = false;

Here is additional information - http://www.ninjatrader-support.com/H...ceOnPanel.html
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-24-2007, 01:08 PM   #3
Richard Von
Member
 
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
Default

Thank you. By the way, note that the description of this in the help dialogue does not tell you WHERE to put this as you have below.
Richard Von is offline  
Reply With Quote
Old 08-24-2007, 01:18 PM   #4
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

Thanks, I will ammend the documentation to make it more clear.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-26-2007, 04:09 PM   #5
gregiii
Member
 
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Yes, this can be done. You have to set the following property in your custom indicator's Initialize() method:

DrawOnPricePanel = false;

Here is additional information - http://www.ninjatrader-support.com/H...ceOnPanel.html
Overlay =false;
DrawOnPricePanel = false or true

DrawLine(CurrentBar.ToString(),0,0,0,800,Color.Red ,DashStyle.Solid,1);

always draw on price panel.

Or did I do something wrong?
gregiii is offline  
Reply With Quote
Old 08-26-2007, 06:01 PM   #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

Likely did something wrong.

I added this to one of my custom indicators and it worked as expected. Keep in mind, my indicator did have a value of 0.4 on it so my line displayed.

Code:
if (CurrentBar > 2)
    DrawLine("Tag1", 2, 0.4, 0, 0.4, Color.Red, DashStyle.Solid, 2);
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-26-2007, 07:46 PM   #7
gregiii
Member
 
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Ray View Post
Likely did something wrong.

I added this to one of my custom indicators and it worked as expected. Keep in mind, my indicator did have a value of 0.4 on it so my line displayed.

Code:
if (CurrentBar > 2)
    DrawLine("Tag1", 2, 0.4, 0, 0.4, Color.Red, DashStyle.Solid, 2);

if you toggle DrawOnPricePanel=false/ture, does your line move to price panel, move to indicator panel accordingly?

I am just trying to draw a vertical line on the bottom indicator panel. The height of the line varies with indicator's value. It keeps drawing on price panel. I am doing this to work around the bug that I need to Add() mutiple plots to change color. See my other posts. http://www.ninjatrader-support.com/v...ead.php?t=2936

With everything else stays the same. I tested DrawText(), DrawRectangle(), these all work just as expected, but DrawLine() does not.

Here is the bare minimum test script. compare the image with the *.cs file. The vertical line shoud appear at the bottom.
Attached Images
File Type: jpg ttt.JPG (96.7 KB, 48 views)
Attached Files
File Type: cs ttt.cs (5.9 KB, 10 views)
Last edited by gregiii; 08-26-2007 at 09:04 PM.
gregiii is offline  
Reply With Quote
Old 08-27-2007, 07:02 AM   #8
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

Your script works as expected. If you make changes to your script, to see these changes in the chart on an already active indicator, you must reload it by pressing F5 in your chart.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-27-2007, 10:18 AM   #9
gregiii
Member
 
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

This is absolutely strange!

Not only I reload with F5, I also shut down NT and rebooted machine today. It consistently produces the chart I posted. Vertical line never goes to the bottom indicator chart. And if you commented out DrawLine(..) statement, DrawText() works as expected. But with DrawLine(..) active, DrawText() does not work either, ie, no character "a" is seen anywhere in the chart.

Can you post an image of chart just with my script loaded, with DrawOnPricePanel = false and DrawOnPricePanel = true.

Thanks
gregiii is offline  
Reply With Quote
Old 08-27-2007, 11:30 AM   #10
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

See images.

Also, managing a lot of draw objects is not optimal, especially if you have many bars on your chart. I would do one of two things -

- Use a plot with style bar or;
- Limit the number of lines drawn to no more than a few hundreded
Attached Images
File Type: jpg false.jpg (88.9 KB, 43 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-27-2007, 11:30 AM   #11
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

The other image.
Attached Images
File Type: gif true.png (97.3 KB, 44 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-27-2007, 12:08 PM   #12
gregiii
Member
 
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

Thanks Ray.

I don't know what to say...

I have not been able to produce a chart with vertical line at the bottom at all. Not even a single line. My original code has if () condition so only a few vertical line would be drawn if DrawLine() works for me.

I know to use bar style to draw indicator. But I only want to draw a few line on the indicator when certain conditions meet.

So with my script, you can generate a correct chart, but I can't! Any suggestions?
Last edited by gregiii; 08-27-2007 at 12:13 PM.
gregiii is offline  
Reply With Quote
Old 08-27-2007, 12:26 PM   #13
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

I would then speculate that the indicator you are working with on the chart is not the one you are modifying in the Editor.

Try creating a brand new indicator with a different name to confirm.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-27-2007, 12:45 PM   #14
gregiii
Member
 
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
Default

I am taling about just using the ttt.cs script I posted. Nothing else is on the chart. The same way you did. But I can't produce the same result as you did. Ture or False, these vertical line always show up at the price panel. Never goes to the bottom panel.

And Yes, I recompiled, reloaded, restarted NT etc. Result is the same.

And yes it is the same indicator as in editor, because I can change the color of the line, just not the location.


That's what's puzzuling
Last edited by gregiii; 08-27-2007 at 12:52 PM.
gregiii is offline  
Reply With Quote
Old 08-27-2007, 12:53 PM   #15
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

I don't doubt you.

To debug, we always need to start at the most basic level. The function for sure works as expected. Therefore, there *MUST* be something on your PC different than mine.

Therefore, create a new indicator with a new name and test this. Assuming this works, then we know there is something with your indicator.
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
Turn off unwanted price markers? higler Charting 5 03-20-2009 05:15 AM
plotting markers on past data x2012 General Programming 2 08-16-2007 06:54 AM
price markers show wrong value when indicator displaced Futures_Shark Charting 1 07-04-2007 11:09 AM
Control of Price Markers on Plot Level whitmark Indicator Development 1 03-29-2007 04:01 AM


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