Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Compare & Alert when Different Contracts Volume Change?

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

    How to Compare & Alert when Different Contracts Volume Change?

    I want to be able to use Market Analyzer in NT7_Beta18 to Compare the Volume of two different Contact Months (ex. Compare ES 09-10 with ES 12-10) and Alert me with both Audio & Visual Alerts when the Forward Month Volume (ES 12-10) becomes Greater than the Current Month (ES 09-10). Can someone Please tell me if this can be done and if so, Specifically how to do this?

    #2
    Hello JMCA2000,

    Welcome to the NinjaTrader forums!

    Unfortunately there's no way this can be setup in the market analyzer. Alerts can only test for value changes for one row, and you'd like to make comparisons across multiple rows. (multiple instruments)

    See here for more information on alerts in the market analyzer.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Do it as a Strategy that runs in background and doesnt trade, only Alerts.

      Pseudo code:

      Inst1 = front month
      Inst2 = next month

      If (vol(Inst2)>vol(Inst1)
      {
      AlertMe
      }

      You might also consider averging the volume instead of using absolute numbers.

      Comment


        #4
        Great, thanks for the suggestion MXASJ.

        For more information on a multiseries strategy, see the sample by clicking Tools > Edit NinjaScript > Strategy > SampleMultiInstrument.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi MXASJ,

          Thank you for your reply.

          I tried creating this with the Strategy Wizard but I could not do it. I don't know where to select the instruments to compare and I'm not sure on how to build the Test Condition using Inst1 = Front Month etc. I understand your if statement, but can not create this because there's no example like this in the Help Manual.

          Would it be asking to much if you could PLEASE Create this for me as an example (Compare ES 09-10 with ES 12-10) so I have something to go by? I don't even know where I would run this Strategy from the background only, for this example and the other nine instruments I compare.

          Thank You for Considering doing this.

          Comment


            #6
            You can't create multi instrument strats with the Wizard I believe. Here are some basic guts to work with:

            PHP Code:
            /// <summary>
            /// Multi-Instrument sample strategy.
            /// </summary>
            [Description("Multi-Instrument sample strategy.")]
            public class 
            SampleMultiInstrumentMod Strategy
            {
            // Variables
             
             
            protected override void Initialize()
            {
             
            Add("ES 12-10"PeriodType.Day1);
             
            CalculateOnBarClose true;
            }
             
            protected 
            override void OnBarUpdate()
            {
            if (
            Volumes[0][0] > Volumes[1][0])
            {
            Print(
            DateTime.Now " Greater Volume is in the ES 09-10 Contract");
            }
            if (
            Volumes[0][0] < Volumes[1][0])
            {
            Print(
            DateTime.Now " Greater Volume is in the ES 12-10 Contract");


            You would add it to the Stratgies tab, Instrument ES 09-10, Daily bars. If it is running than once a day it should print to the output window "Greater Volume is in the ES-09 contract." If you add it via the Strategies tab you don't need a chart open, which is what I meant by running it in background.

            You could also set that up to email you, or pop up an alert in the alerts window.

            I haven't really tested that code but it should get you started.

            Comment


              #7
              I will try to build on this. Thank you very much !!!!!

              Comment


                #8
                Thanks for sharing this snippet, MXASJ!
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by aligator, 01-06-2022, 12:14 PM
                2 responses
                222 views
                0 likes
                Last Post john_44573  
                Started by dmking, 11-12-2019, 12:31 PM
                4 responses
                4,140 views
                0 likes
                Last Post jasonw
                by jasonw
                 
                Started by roblogic, Today, 04:31 PM
                0 responses
                7 views
                0 likes
                Last Post roblogic  
                Started by morrnel, 05-12-2024, 06:07 PM
                4 responses
                57 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by xepher101, 05-10-2024, 12:19 PM
                6 responses
                73 views
                0 likes
                Last Post xepher101  
                Working...
                X