![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Apr 2007
Location: Longmont, Colorado, USA
Posts: 296
Thanks: 4
Thanked 3 times in 3 posts
|
I am drawing an UpArrow on my chart at various locations. I would like to draw text at a fixed distance below the arrow. Can someone tell me how to do this? I am drawing the arrow at Low[0] - .5 * TickSize. If I position the text at a multiple of TickSize such as Low[0] - 2 * TickSize then the distance below the arrow varies depending on how compressed the chart gets when there are large price variations. I would like the text to be a fixed distance below the arrow always. Thanks.
|
|
|
|
|
|
#2 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Please take a look at this syntax version for DrawText()
DrawText(string tag, bool autoScale, string text, int barsAgo, double y, double yPixelOffset, Color textColor, Font font, StringAlignment alignment, Color outlineColor, Color backColor, int opacity) I think the yPixelOffest parameter can be useful in your case.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
|
I'm using this:
DrawText("ask", false, "Ask: "+askRows[0].Price + " Vol: "+askRows[0].Volume, 0, High[0], 100, Color.Red, font, StringAlignment.Far, Color.Transparent, Color.Transparent, 50); I want the text to be the X= 5 (five bars back from currentbar), and Y = HighestBar(High, 20) but whenever I use those values I see NO text anywhere. If I plugin the above values they show up ok. |
|
|
|
|
|
#4 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Try this code instead:
Code:
DrawText("test", false, "Test Text", 5, MAX(High, 20)[0], Color.Red, new Font("Arial", 12), StringAlignment.Far, Color.Transparent, Color.Transparent, 50);
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
|
Well, the problem is the "5", unless I use "0" for X, I don't see it. Why? I tried your code, did not see it, I replaced 5 with 0 and it shows up.
|
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Check your Control Center logs. You most likely need to put in a
Code:
if (CurrentBar < 5)
return;
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
|
Yes. Ok, so can I get the data to update like T&S? Instead of just OnBarUpdate()? I want to get the bid and ask, as they come in, not wait till chart updates it, is that possible?
|
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Sure. Check out the advanced methods OnMarketData() or OnMarketDepth().
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| DrawText API doc? | mazachan | General Programming | 1 | 03-04-2008 03:12 PM |
| DrawText | Mike Winfrey | General Programming | 1 | 12-21-2007 04:57 PM |
| Vertical positioning | ralph.ronnquist | Indicator Development | 1 | 12-07-2007 10:39 PM |
| DrawText, DrawLine, etc... | funk101 | Indicator Development | 2 | 05-27-2007 01:13 PM |
| Positioning of Manually Drawn Objects | whitmark | Charting | 1 | 03-27-2007 05:59 AM |