Is there a simple way to consistently print the same distance at the top or bottom of each bar irrespective of the Instrument and chart period ?
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
how can I draw text over minute chart bars at the same distance everytime
Collapse
X
-
how can I draw text over minute chart bars at the same distance everytime
Hi - I am trying to figure out a way to always print text over select bar on a minute chart.. (E.g. I want to print if a candle is engulfing or not, pin-bar or not).. The problem is that when I change the instrument or the even the period (e.g. 3mins to 15mins), then the labels printed are far away from the candle top/bottom or too close to the top/bottom.
Is there a simple way to consistently print the same distance at the top or bottom of each bar irrespective of the Instrument and chart period ?Tags: None
-
Hello jpkulkarni,
To print text at an offset from a bar you could use Draw.Text and supply a price from the bar in question and then use the yPixelOffset field to give the text a fixed offset from the bar.
Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, int barsAgo, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)
JesseNinjaTrader Customer Service
-
Yeah.. I have been using that offset value.. the problem is that offset needs to be different for each instrument and chart period. I am trying to figure out how to keep changing that offset dynamically for selected instrument and period..
Comment
-
Hello jpkulkarni,
You may need to add a user input that you can set for each instrument when you apply the script to control that. Each instrument trades at different prices and will have different scale values and compression of the chart so there would not be a way to ensure that there is always a set distance from the bars besides using the y offset.
You may be able to come up with some general logic to make a dynamic value based on the instrument and timeframes being used. I would not have any specific recommendations on that, you would likely need to experiment to see what works best for the instruments you use and what values you use for the offset to get an idea if an equation could be made to control that.
JesseNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,404 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
95 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
7 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
159 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment