NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


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 05-14-2007, 05:04 PM   #1
kausti
Junior Member
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default several probs with auto custom script strategies

Hi,
I have a self coded strategy and I am experiencing several problems while executing in real time.

* My positions exit twice. For a short position, when I call exit, there is a close position fill and a buy to cover fill. I end up with one long position in the end. Same scenario happens with long orders.
I am using EnterLong(), EnterShort and ExitShort(), ExitLong(). To give an example, consider this actual event. I am short 1 GBPUSD. It exits twice and then my strategy goes long at the same time. So instead of 1 long, now I am 2 long. Real fun begins now. Strategy exits long positions and I am 2 short, just because it closed twice, and then my strategy goes short. I am 3 short. So the strategy that started with 1 position max in each direction has me with 3 short positions somehow!! thankfully I am still testing on sim account.

* I start strategy from strategy tab. When I stop a strategy by clicking stop button, it cancels stop and limit orders but any open positions are not closed.
Then I close the positions manually. Next time I start strategy, the previous open position shows up. e.g. if I am long GBPUSD, I stop strategy, it cancels stop and limit orders. Long GBPUSD is left untouched. I close manually. Next time I start strategy on same instrument, it shows 1 long GBPUSD. There is no actual open position and it's not there in positions tab. There is no way to close this position and there are no stop/limit orders for this ghost position.
I have "cancel strategy orders on strategy termination" checked in the options menu.

* Sometimes when I start a strategy, I get "DB ....object not being tracked" error. the strategy starts anyway.

I am using version 6.0 and Gain capital data feed for forex.

I hope these issues are resolved quickly so I can atleast begin testing my strategies correctly real time and feel confident enough to go live.

Thanks,
K
Last edited by kausti; 05-14-2007 at 05:24 PM.
kausti is offline  
Reply With Quote
Old 05-14-2007, 08:36 PM   #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
Default

K,

Three separate issues here.

1) Is this reproducible each time you run a strategy? If yes, I would want to reproduce this on our test machines.

2) This is correct behaviour. A strategy position is NOT automatically synchronized to your account position. When you start a strategy, it historically calculates the current position of the strategy (virtual position), should you wish to synchronize your account position, you would have to manually enter an order so they match up.

3) This issue is hopefully resolved with our next update.
NinjaTrader_Ray is offline  
Reply With Quote
Old 05-15-2007, 07:09 AM   #3
kausti
Junior Member
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 times in 0 posts
Default

Hi,
Thanks for reply.

The first issue is reproducible "most" times I run strategy. It happens about 70-80 % times. I don't know how to reproduce it but could send you my logs so you can confirm the behavior.

You say,
"A strategy position is NOT automatically synchronized to your account position. When you start a strategy, it historically calculates the current position of the strategy (virtual position), should you wish to synchronize your account position, you would have to manually enter an order so they match up."

I don't get this. So if my strategy has an open position, and I need to terminate strategy, how am I supposed to do it. The documentation clearly says not to manually close strategy position and and in case you have to, terminate the strategy itself. Please clarify.

Thanks,
Kausti
kausti is offline  
Reply With Quote
Old 05-15-2007, 07:21 AM   #4
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
Default

Please run your strategy, next time this happens, mark the time and send me an email to ray at ninjatrader dot com via Help > Mail to Support within the Control Center window.

Why would you need to terminate your strategy if it has a starting position? Here are your options:

1) Manually place an order in the Control Center Orders tab into the account the strategy is running on in order to "sync" your account position to the strategy position.

2) Set the option "Wait until flat before executing live" http://www.ninjatrader-support.com/H...tegiesTab.html
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
NTMarketPosition in EFS script Oli Automated Trading 3 02-27-2007 04:47 AM
Secure distribution of custom Indicators and Strategies ThePatientOne Indicator Development 7 02-22-2007 12:49 AM
Using the script output window SuzyG General Programming 5 12-02-2006 04:01 AM
Limit Position Strategies displayed in Combo Box & Inactive Strategies signals Suggestions And Feedback 4 04-10-2005 12:02 PM
Using the script output window SuzyG Automated Trading 2 12-31-1969 06:00 PM


All times are GMT -6. The time now is 03:14 AM.