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 > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-27-2011, 08:12 AM   #1
zeller4
Senior Member
 
Join Date: Sep 2008
Posts: 185
Thanks: 20
Thanked 2 times in 2 posts
Default Built-In Sound Files in Unmanaged Strategy

Hello,

I have an Unmanaged strategy that places orders using code similar to
Code:
SubmitOrder(0, OrderAction.Buy,  .....
When orders are pending and filled, targets and stops are pending / filled / cancelled, etc., the built-in audio files stating "Order Pending", ""Order Filled" are correctly played.

However, the other sound files (that I normally receive using ATM orders) are not played - i.e. "Target Filled", "Stop Filled", etc. In fact, when a stop is filled, the "Order Filled" audio file is played. I have not modified these files nor their path.

As I said, these work on other ATM orders for the various built-in sound files.

Since this is unmanaged, do I need to place order code such that these other sound files will play?

Best Regards,

Kirk
zeller4 is offline  
Reply With Quote
Old 07-27-2011, 08:18 AM   #2
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

Kirk, unmanaged strategies don't know what sort of orders get filled, so that is why you receive the "Order filled" audio every time any order is filled. If you want a different sound to play when your stops/targets are executed, you'll need to code that in yourself (in OnExecution()). Please let me know if you have any other questions.
NinjaTrader_Austin is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Austin for this post:
Old 08-13-2012, 02:11 PM   #3
edgeliner
Senior Member
 
Join Date: Oct 2007
Location: Southy Florida
Posts: 263
Thanks: 16
Thanked 1 time in 1 post
Default

Austin...... I was wondering the same thing.....In the OnExecution() section, how would the code look if you wanted it to say "Stop Filled" when the stop gets filled because of the stoploss?? Thanks!
edgeliner is offline  
Reply With Quote
Old 08-13-2012, 03:43 PM   #4
NinjaTrader_JC
NinjaTrader Customer Service
 
NinjaTrader_JC's Avatar
 
Join Date: Mar 2012
Location: Denver, CO
Posts: 1,197
Thanks: 135
Thanked 181 times in 180 posts
Default

Hello edgeliner,

You would want to use the GetAtmStrategyStopTargetOrderStatus() method for this to be able to get the status of the stop or target order. So you could do something like this:


Code:
		protected override void OnExecution(IExecution execution)
		{
			string[,] stopLossFilled = GetAtmStrategyStopTargetOrderStatus("STOP1", atmStrategyId);
			
			if( stopLossFilled.Length > 0)
			{
				for(int i = 0; i < stopLossFilled.GetLength(0); i++)
				{
					
					if(stopLossFilled[i, 2].ToString() == OrderState.Filled.ToString())
					{
						Alert("Alert1", Priority.Low, "stop filled", "StopFilled.wav", 2, Color.White, Color.Black);
					}
				}
				
			}
		}
Here is a link to our Help Guide that goes over GetAtmStrategyStopTargetOrderStatus() that you may view:
http://www.ninjatrader.com/support/h...rgetorders.htm

Note, that you would have to have the same atmStrategyId to be able to get the proper order state. For an example of the ATM Strategy method you can go to the Control Center -> Tools -> Edit NinjaScript -> Strategy and double click on the SampleAtmStrategy to view some code.

Let us know if we can be of further assistance.
NinjaTrader_JC is offline  
Reply With Quote
The following user says thank you to NinjaTrader_JC for this post:
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
Sound files pkinoc ATM Strategies (Discretionary Trading) 7 11-14-2011 03:21 PM
Sound files gg80108 General Programming 1 02-17-2011 08:38 AM
Controlling Strategy Order Sound Files sgordet Strategy Development 1 01-03-2011 03:05 AM
sound files donthiessen Miscellaneous Support 2 11-09-2010 08:49 AM
Sound files... funk101 General Programming 3 04-29-2007 07:51 PM


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