NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 01-09-2007, 11:23 PM   #1
DarrylT
Junior Member
 
Join Date: Jan 2007
Location: Boston
Posts: 29
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Hi,

I'm working with NTv6.0.0.5 developing a custom strategy in NinjaScript. I'm getting a compile error ("The name 'MarketPosition' does not exist in the current context.") on this line in OnBarUpdate:

if (Position.MarketPosition != MarketPosition.Flat) {}

It's complaining about the 'MarketPosition.Flat', has something changed since the Help file was created? How can I check the current market position being long, shortor flat?

Thanks.


DarrylT is offline  
Reply With Quote
Old 01-10-2007, 01:25 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Post imported post

Can you email me your entire cs file where this problem is occuring? Email to ray at ninjatrader dot com. This should work, but need to see your code.


Ray
NinjaTrader_Ray is offline  
Reply With Quote
Old 01-10-2007, 05:45 AM   #3
AlohaBob
 
Join Date: Dec 2006
Location: , ,
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

The exact syntax you show works fine in 6.0.0.4. Did you have this working earlier, or is this a new effort?

I'm just about to download 6.0.0.5. I'll let you know if my program using this syntax works there.

Bob
AlohaBob is offline  
Reply With Quote
Old 01-10-2007, 05:49 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Post imported post

This was a user error. User had copied indicator code to a strategy code and as a result was missing some critical "using declarations".

Ray
NinjaTrader_Ray 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


All times are GMT -6. The time now is 04:39 AM.