NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 08-10-2012, 04:29 AM   #1
kenb2004
Senior Member
 
Join Date: Jul 2010
Posts: 415
Thanks: 1
Thanked 4 times in 4 posts
Default Bools and NinjaTrader Internal Logic

In programing I like to create bools to consolidate code, but I am concerned about doing this with NinjaTrader Internal Logic. I do not want to compromise the integrity of my strategy. Can you please tell me if the following code would have adverse reactions to a strategy.
Thanks
Code:

private bool Long {get { return Position.MarketPosition == MarketPosition.Long; } }

or
Code:

private bool Long1 {get { return Position1 == MarketPosition.Long; } }
kenb2004 is offline  
Reply With Quote
Old 08-10-2012, 04:37 AM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello kenb2004,
NinjaTrader is basically C# and will use any standard C# logics/features.

You can simply write a function. A sample code will be like

Code:
private bool Long()
{
 return Position.MarketPosition == MarketPosition.Long;
}
http://www.ninjatrader.com/support/h...s_explaine.htm
NinjaTrader_Joydeep is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Optimize with bools? Here's how! jeronymite General Programming 6 09-20-2012 07:42 AM
Using Bars with Bools CaptainAmericaXX General Programming 2 04-14-2011 11:29 AM
Bools and [] indexing kenb2004 Strategy Development 5 02-28-2011 11:41 AM
Working with NinjaTrader internal database Silence Miscellaneous Support 2 05-15-2010 11:01 AM
ints and bools??? John833 Strategy Development 2 12-08-2008 09:40 AM


All times are GMT -6. The time now is 05:07 AM.