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
globalLine
Collapse
X
-
Hello,
For User Drawn Objects you could use the code below to find all user drawn horizontal lines and print out the value the user drawn horizontal line is drawn at and the color of the horizontal line.
foreach(IDrawObject draw in DrawObjects)
{
if(draw.UserDrawn)
{Print(draw.DrawType.ToString());//you can get the tag of the object to help narrow down results
if(draw.DrawType == DrawType.HorizontalLine)//if the object type is a horizontal line do this
{
IHorizontalLine horizontalLine = draw as IHorizontalLine; //neeed to re define the IDrawingObjects as a Horizontal line to access corect values
Print(horizontalLine.ToString() + horizontalLine.Pen.Color);
}
}
}
For more information on IDrawObject please see the following link, http://www.ninjatrader.com/support/h...drawobject.htm
For more information on IHorizonatalLine please see the following link, http://www.ninjatrader.com/support/h...zontalline.htm
If we can be of any other assistance please let me know.Cody B.NinjaTrader Customer Service
-
Hello,
Can you clarify where you are seeing the comma?
If you are seeing this as where the decimal place is you could use the following to have the value print without any decimal places.
Print(horizontalLine.Y.ToString("#") + " "+ horizontalLine.Pen.Color);
This will print out just the integer value of the Y value. If you wanted to print out with decimals up to a certain point, say up to two decimal places for example, you would format it as ToString("##.##");
You can view more information on Numeric Formatting at the following link, https://msdn.microsoft.com/en-us/lib...vs.110%29.aspxCody B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Davidtowleii, Today, 12:15 AM
|
0 responses
3 views
0 likes
|
Last Post
by Davidtowleii
Today, 12:15 AM
|
||
Started by guillembm, Yesterday, 11:25 AM
|
2 responses
9 views
0 likes
|
Last Post
by guillembm
Yesterday, 11:58 PM
|
||
Started by junkone, 04-21-2024, 07:17 AM
|
9 responses
68 views
0 likes
|
Last Post
by jeronymite
Yesterday, 11:51 PM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
22 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by mgco4you, Yesterday, 09:46 PM
|
1 response
12 views
0 likes
|
Last Post Yesterday, 09:56 PM |
Comment