Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Built-In Sound Files in Unmanaged Strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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

    #2
    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.
    AustinNinjaTrader Customer Service

    Comment


      #3
      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!

      Comment


        #4
        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.
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kaywai, Today, 07:09 AM
        2 responses
        4 views
        0 likes
        Last Post kaywai
        by kaywai
         
        Started by SoCalFuturesFX, 11-06-2023, 11:08 AM
        3 responses
        218 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by HiddenPhilosopher, 05-22-2020, 01:09 AM
        26 responses
        2,713 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by Uregon, Today, 03:44 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Started by sofortune, 05-16-2024, 11:45 PM
        6 responses
        44 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X