![]() |
|
|||||||
| 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. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Junior Member
Join Date: Jan 2010
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
|
I've read the text on ATMs within strategies and have the sample ATM strategy, but I've only just started manually altering strategies so I'm not too clear on what I should be including or not. The code I have currently is as below (although I have this repeated several times for different trade entry conditions), but it seems to be taking in more than one order every so often. Am I missing some important code and if so, what?
Many thanks Mike if (GetAtmStrategyMarketPosition("10 tick") == MarketPosition.Flat && (SEVERAL CONDITIONS FOR STRATEGY) { AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 10, TimeInForce.Day, GetAtmStrategyUniqueId(), "10 tick", GetAtmStrategyUniqueId()); } |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi Mike,
You'll want to work mainly from the sample. All the string structure there is required to control order submission. To save a copy of the sample: Right Click > Save as and provide a new name. About the only part of the sample you should remove or comment is the stop price change block. // You can change the stop price
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2010
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
|
Thanks Ryan,
I've done as you suggested. I've run it within a market replay. It currently takes in one order and once that's closed out it takes in no more. I repeatedly get an error in the output window: **NT** GetAtmStrategyMarketPosition() method error: AtmStrategyId 'AtmStrategyTemplate' does not exist I created an 'AtmStrategyTemplate' (just in case it actually needed to be called that!). I have also repeated the ATM template code for each entry block. Any idea what's likely to be going wrong here? Many thanks Mike |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
The AtmStrategyId should not be named the same as the template. These are two different things. The ID is internally generated and will never be a readable string like "AtmStrategyTemplate". The code changes you made to assign atmStrategyId = "AtmStrategyTemplate" won't work.
"AtmStrategyTemplate" used in code should match the name of an ATM strategy template you create in another window, like the SuperDom. You should not have to change much from the sample to see it working. Best will be to play around with an unmodified sample until you get the hang of it. There's a lot of parts, and the print statements used there are designed to show the code flow. Follow these steps to see a working NS > ATM strategy: 1) Create an ATM strategy in the SuperDom called AtmStrategyTemplate. See here for help managing ATM templates. 2) Run the unmodified SampleAtmStrategy. On bars that close higher than open, a limit order is submitted at the low of the bar. If this order is filled, you'll then see an ATM strategy applied. Use Tools > Output Window to monitor for messages, and a SuperDom or ChartTrader to visualize the orders.
Ryan M
NinjaTrader Customer Service
Last edited by NinjaTrader_RyanM; 08-08-2011 at 01:42 PM.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple ATM trades | shazzmoe | ATM Strategies (Discretionary Trading) | 1 | 02-03-2011 09:21 AM |
| Multiple Setups using ATM | trumpy | ATM Strategies (Discretionary Trading) | 3 | 10-24-2009 08:00 AM |
| About ATM multiple bracket orders ? | Mokidoki | Miscellaneous Support | 2 | 06-22-2009 03:47 AM |
| Multiple Orders to Create Single ATM Managed Position | gambit50 | ATM Strategies (Discretionary Trading) | 5 | 05-19-2009 10:18 AM |
| Multiple Limit Orders in a single ATM Strategy Order? | Acapulco | ATM Strategies (Discretionary Trading) | 1 | 06-19-2008 05:31 AM |