![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
Guys,
I know this has already been done in this forum. Buy I can't find it. I have done all the seraches I know. Can anyone help. I am very new at programming C# but ok at cut and paste by example. I want to do an OCO order to buy or sell short the prior bar as compared to current bar, only have one position open at a time, and set a profit and stop loss bracket around the trade. Any help would be appreciated. Thanking you in advance. jstockman |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Unfortunately we are unable to implement actual strategies for bandwidth reasons. But maybe the community can contribute.
We will enhance the list of sample strategies shortly.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
It means that our current policy is to provide application level support and are unable to provide support at a level where we provide sample code upon request or analyze user code.
Thanks for understanding.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
Ray, How do you suggest we get answers then if we can't find it on the forum? jstockman |
|
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
You can get answers to product questions in our forum.
We will absolutely provide answers to questions related to the operation of our product. To help in the area of programming logic, we are doing the following: - Developing a comprehensive reference sample library - Developing a "NinjaScript" online live training course - Hiring more NinjaScript support engineers This is all work in progress and we hope to have these additional resources available to the community sooner than later. Thanks for understanding.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#7 | |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
That gives me future hope. Press On! jstockman |
|
|
|
|
|
|
#8 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
jstockman there are two ways to proceed with what you are trying to accomplish. You can use ATM strategies or you can use things like EntriesPerDirection and EntriesHandling to achieve the effect you want.
For the ATM strategy approach: This link will help you on coding your entries http://www.ninjatrader-support.com/H...egyCreate.html. This one shows you how to cancel previous orders http://www.ninjatrader-support.com/H...egyActive.html. This one shows you how to modify previous orders instead of canceling it http://www.ninjatrader-support.com/H...helpguide.html. With ATM strategy, you create the entry and then you can manually manage the stop/profit targets from within any order entry windows. Check out the Video library section on ATM strategies on how to maximize its efficiency http://www.ninjatrader-support.com/H...l?VideoLibrary. For the non-ATM approach: You can use things like EnterLong/EnterShort with this method. What you want to do in the Initialize() section of your code is add two lines. Code:
EntriesPerDirection = 1; EntryHandling = EntryHandling.AllEntries; http://www.ninjatrader-support.com/H...yHandling.html Please note that EntriesPerDirection and EntryHandling DO NOT affect ATM strategies. For ATM strategies you might need to add some programming checks to insure you don't enter while you have a position open. I believe you can use something like this to check if you have a position open or not. Code:
Position.MarketPosition==MarketPosition.Flat Personally I have not experimented much with the ATM strategy approach, but it might be more suitable if you want to manually manage your positions after your strategy enters them. In the non-ATM approach you will need to manually program ExitLong() and ExitShort() at where you want the profit target and where you want the stop loss to be. I hope this helps jstockman. If you are still having problems why don't you post up your strategy and I'll take a look and see if I can give you any pointers?
Last edited by NinjaTrader_Josh; 08-19-2007 at 11:58 AM.
|
|
|
|
|
|
#9 |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
uacvax,
Thank-you for the help. I want to take a look at TRO Trillion using this method. jstockman
Last edited by jstockman; 08-19-2007 at 12:18 PM.
Reason: Too much space
|
|
|
|
|
|
#10 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
I've only heard about the TRO Trillion strategy. Never really looked deep into it. Please let me know how it goes.
|
|
|
|
|
|
#11 | |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
Josh, Please confirm my thinking. I can create an ATM strategy using the wizard. When I want engage this ATM strategy I use the above command. (Or is it just the opposite). I create the above strategy and then somehow using the Superdom ( which will show me the trade postion) I manage it manually? Thanks for the clarification. jstockman
|
|
|
|
|
|
|
#12 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
Are you referring to the NinjaScript Strategy Wizard? I do not believe you can automatically create ATM strategies straight from that wizard, but you can definitely use the wizard to create your strategy and then add in the ATM strategy stuff.
What happens when you run your NinjaScript strategy with ATM strategies coded inside is it will execute orders that you will be able to manually manage through any of NinjaTrader's order management windows (e.g. SuperDOM).
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#13 | |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
I get it! Is there a way around limitations on EntriesPerDirection etc.? "ATM Strategies operate in real-time only and will not execute on historical data thus they .Executions resulting from an ATM Strategy that is created from within a NinjaScript automated strategy will not plot on a chart during real-time operation .Strategy set up parameters such as EntriesPerDirection, EntryHandling, ExitOnClose do not apply when calling the AtmStrategyCreate() method" jstockman |
|
|
|
|
|
|
#14 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 107 times in 70 posts
|
What you could try is just pass around a variable that is 1 when you already have an ATM position open and 0 when it is flat. Basically just have an if statement checking if this variable is 1 or 0 and only allow for a new AtmStrategyCreate() when it is 0.
You can use GetAtmStrategyMarketPosition() to determine if you have an ATM strategy position open or not. Just pass along the AtmStrategyId to it and you should be good to go. http://www.ninjatrader-support.com/H...yPosition.html
Josh
NinjaTrader Customer Service
Last edited by NinjaTrader_Josh; 09-06-2007 at 11:34 PM.
|
|
|
|
|
|
#15 |
|
Member
Join Date: Aug 2007
Location: California
Posts: 41
Thanks: 0
Thanked 0 times in 0 posts
|
Josh,
Thank-you for pointing me in the right direction. I have just read the docs in NT regarding this area. Looks pretty straight forward. The stategy I am heading for is found in the Tradestation Forum under Trillion Dollar. Using daily bars I look to go long on first current bar that crosses above prior day high or go short if crosses below prior days low. The trick is to have one position open either long or short depending what broke open first. TRO sets his profit about 5 and stop about 7. It is kind of backwards to what all the books teach. But the stats bear out good percentages for the trade. I'll keep you posted. Regards, jstockman
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 1st Hour High/Low | pijamatrader | Indicator Development | 42 | 07-16-2007 05:31 PM |
| Pivots and Prior Days OHLC Problem | stargazer | Charting | 13 | 07-13-2007 07:02 AM |
| PriorDayOHLC() question about prior session | SuzyG | General Programming | 4 | 04-29-2007 01:30 PM |
| Re: Prior Day OHLC Indicator | Antraman | Indicator Development | 12 | 06-07-2006 12:31 AM |
| Prior Day OHLC Indicator (Download) Version 5 Only | NinjaTrader_Ray | Indicator Development | 1 | 05-19-2006 02:18 AM |