![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jul 2008
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
|
Hi, I am trying to create a Ninjascript using the strategy wizard, but I'm having a few problems completing it. I attached the exported file to this post.
I want to place a long and a short order, at a certain time and a certain date, which would vary, and need to be changed whenever the ninjascript is used. Each order would be a stop limit order offset from the current price by about 10 ticks, and would cancel the other order if it was executed. If executed it would then implement a selected ATM strategy which would work in real time only, as stated in the help file. If neither order was executed it i would like to cancel both after a certain time. The ATM strategy would take care of the trade from there. I have attempted to set up a basic version of the ATM strategy using Stop and Profit Targets in the Ninjascript. When I tried to back test it, I got an error message saying that ninjatrader needs to shut down, although it didnt shut down. Can you tell me what is wrong with the script? The wizard said that it completed successfully. Is it possible to have user input as part of a Ninjascript, by using an input box? E.g. To set the time and date. As a more advanced version I would like to have user input of a number to trigger the trades being set after the time is reached. Would this be possible? Thanks, Matthew |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
|
Hi Matthew,
You are not allowed to submit two entry orders at the same time. This violates are order handling rules for a strategy. You will have to remove one of these orders and try again.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
|
To trade on both sides of the market I've split my strategy into long and short parts, executed independently, If you also wanna submit a pair of orders from each as OCO you'll need a global C# class keeping track of your orders.
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jul 2008
Posts: 12
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the replies. Does this mean I can't submit 2 orders at the same time, even if they'e OCO, or can they be submitted at slightly different times? E.g. 30 secs apart. I have run this strategy in MetaTrader no problem, so I thought I would be able to do it with NinjaTrader as well. Billitin, could you explain in more detail how this works? How do I get a global C# class to manage the orders?
|
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Jun 2008
Posts: 146
Thanks: 0
Thanked 0 times in 0 posts
|
You'll need to create a class in namespace NinjaTrader.Strategy (use any strategy template file for that) and initialize it only once per all run strategies, so that you can pass all your orders through it to modify them as needed and when necessary. From my experience it's not such an easy coding task for a beginner or someone who wants to learn the language... In the ideal world I'd rather find a way to execute my trades differently as I'm currently climbing the same wall
Last edited by billitin; 07-11-2008 at 11:38 PM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Josh or any advanced c# programmer please please help | whitegun | General Programming | 12 | 07-05-2008 11:33 AM |
| New Programmer - Missing .dll File | ramckay | General Programming | 1 | 03-31-2008 09:09 PM |
| Programmer | abikambic | Strategy Development | 1 | 03-17-2008 07:44 PM |
| A simple question from a new NT programmer | elemento-portador | Indicator Development | 1 | 11-05-2007 08:00 AM |