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 04-26-2007, 04:35 AM   #1
MrBaffalo
Senior Member
 
Join Date: Nov 2006
Location: Ferrara, , Italy
Posts: 138
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Hi all,

I'm wrestiling with order logic: I wrote an easy system wich exits multiple positions, orders seem to be placed and executed fine, but controc center->orders shows a redundant "cancelled". I really do not understand what can cause that.

Below a piece of the code:

Code:
if (Position.MarketPosition != MarketPosition.Flat)

if (Position.MarketPosition == MarketPosition.Long){

if (Position.Quantity == ctr)

{



ExitLongLimit(ctr/3, (Position.AvgPrice + target1), "1st Exit", "");

ExitLongStop(ctr, (Position.AvgPrice - stop), "1stStop", "");
And attached a snapshot of the contro center.

The problem is that second "buytocover" limit orders which appears after the same order has been filled.

Thanks in advance for your help,

regards

Marce
Attached Images
File Type: jpg fills.jpg (162.8 KB, 10 views)
MrBaffalo is offline  
Reply With Quote
Old 04-26-2007, 05:04 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Post imported post

I can't tell what or what not your strategy should be doing from the information provided. When trade is entered, are thereredundant live orders placed? If not, when does that order come live and cancel? Although the Control Center Log tab can be difficult to read, you can review it to see the sequence of how and what orders placed live to gain an understanding what may be happening.

Ray
NinjaTrader_Ray is offline  
Reply With Quote
Old 04-26-2007, 05:44 AM   #3
MrBaffalo
Senior Member
 
Join Date: Nov 2006
Location: Ferrara, , Italy
Posts: 138
Thanks: 0
Thanked 0 times in 0 posts
Post imported post

Thanks Ray, tomorrow I'll have a look, but something is not working fine, I need to debug and debug...and this is a very simple and easy code made to understand logic.:?

p.s. When I apply the strategy, past orders are placed fine and fine appears execution, qhile running on live data...something doesn't work.

thanks

Marce
MrBaffalo 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 07:05 AM.