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 06-19-2007, 10:55 PM   #1
crazytiger
Junior Member
 
Join Date: Jun 2007
Posts: 5
Thanks: 0
Thanked 0 times in 0 posts
Default Help with a Basic Script

My code is attached as a text file (ipv10.txt).

It is quite basic. All it does is enters into a long position and enters a stop loss and profit target for that order. Once that order reaches target or is stopped out, I want to enter a new order at the current market price. I want to keep repeating this until I stop the strategy.

I noticed 2 problems with this code:

1. When I load the strategy for the first time on a chart, it immediately enters a long position as it should. But if I ratchet up or down the trend simulator, it never excutes the target profit or stop loss. Why??

2. If I now stop that strategy and manually close out the long position, and then reload the strategy, it appears to enter a long position as shown by the unrealized profit value that gets updated in real-time (in the strategies tab). But the position tab does not show an open position. What could be happening here?

Once I shut down Ninja and restart it, open a new chart and load my strategy, a new long position is filled.

I hope my code gives an easy clue as to these 2 issues.
Attached Files
File Type: txt ipv10.txt (3.0 KB, 21 views)
crazytiger is offline  
Reply With Quote
Old 06-20-2007, 02:55 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

Sorry, we are unable to provide support at this level. I suggest:
- try "debugging" by adding Print() statements
- check out the TradeOrders option
- you might conseder contacting a NinjaTrader consultant: http://www.ninjatrader.com/webnew/pa...injaScript.htm
NinjaTrader_Dierk 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
code script question abikambic General Programming 8 06-19-2007 07:23 AM
several probs with auto custom script strategies kausti Automated Trading 3 05-15-2007 07:21 AM
NTMarketPosition in EFS script Oli Automated Trading 3 02-27-2007 04:47 AM
Using the script output window SuzyG General Programming 5 12-02-2006 04:01 AM
Using the script output window SuzyG Automated Trading 2 12-31-1969 06:00 PM


All times are GMT -6. The time now is 01:43 AM.