![]() |
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 |
|
Member
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
|
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? |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Jul 2007
Posts: 93
Thanks: 0
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Thanks, I will ammend the documentation to make it more clear.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Member
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
|
Quote:
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? |
|
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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);
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#7 | |
|
Member
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
|
Quote:
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.
Last edited by gregiii; 08-26-2007 at 09:04 PM.
|
|
|
|
|
|
|
#8 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Member
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
|
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 |
|
|
|
|
|
#10 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
The other image.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Member
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#13 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Member
Join Date: Aug 2007
Posts: 51
Thanks: 1
Thanked 0 times in 0 posts
|
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.
|
|
|
|
|
|
#15 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |