NexusFi: Find Your Edge


Home Menu

 





NT8 Print DrawingTools Help


Discussion in NinjaTrader

Updated
    1. trending_up 1,397 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

NT8 Print DrawingTools Help

  #1 (permalink)
tiger1
London, UK
 
Posts: 16 since May 2015
Thanks Given: 7
Thanks Received: 1

In NT8, I am having trouble with the following code, I need urgently to start manual back testing:

Code:
 
Code
Print(Message); //Hello World!
				
				foreach (DrawingTool draw in DrawObjects)
				{
					if (draw.GetType().Name == "Dot")
						{
						Print("Dot");
						Print(draw.GetType());					
						Print("Dot2");
						DrawingTools.Dot myDot = draw as DrawingTools.Dot;
						Print(myDot.Anchor.Price); 
				}
Quote:

Quoting 
Hello World!
Hello World!
Dot
NinjaTrader.NinjaScript.DrawingTools.Dot
Dot2
Strategy 'Test2': Error on calling 'OnStateChange' method: Object reference not set to an instance of an object.

After Dot2 I can't get what I really need, to print (myDot.Anchor.Price)

Thanks!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Quantum physics & Trading dynamics
The Elite Circle
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
25 thanks
What is Markets Chat (markets.chat) real-time trading ro …
17 thanks
ApexTraderFunding.com experience and review
15 thanks
GFIs1 1 DAX trade per day journal
13 thanks
EG Indicators
11 thanks
  #2 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

Your piece of code should be in OnBarUpdate(), is it now?


tiger1 View Post
In NT8, I am having trouble with the following code, I need urgently to start manual back testing:

Code:
 
Code
Print(Message); //Hello World!
				
				foreach (DrawingTool draw in DrawObjects)
				{
					if (draw.GetType().Name == "Dot")
						{
						Print("Dot");
						Print(draw.GetType());					
						Print("Dot2");
						DrawingTools.Dot myDot = draw as DrawingTools.Dot;
						Print(myDot.Anchor.Price); 
				}
Quote:

After Dot2 I can't get what I really need, to print (myDot.Anchor.Price)

Thanks!


Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #3 (permalink)
maryfromcolorado
Denver CO USA
 
Posts: 32 since Sep 2016
Thanks Given: 0
Thanks Received: 13


Is Dot a multi anchor property (Anchor would be null and you would get that error)

Try iterating

foreach (ChartAnchor chartAnchor in myDot.Anchors)
{
Print(chartAnchor.Price);
}

Reply With Quote




Last Updated on November 28, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts