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

Inter-Strategy Communication

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

    Inter-Strategy Communication

    Hello Support,

    I am creating a strategy in which i need to do a little bit of inter-strategy communication. Here is the scenario:

    I will have multiple instances of the same strategy running simultaneously on same and/or different instruments with same and/or different parameter settings. I need to achieve a stop & reverse feature whereby if the program is Long with Strategy 1 and before the position is closed, Strategy 2 signals a Short trade, we would like for the program to Close the LONG position and Initiate the SHORT one.

    Now what i dont understand is how to make the communicate between Strategy 1 & Strategy 2 so that i can code this feature. For reference, i am using the unmanaged approach for orders in my strategy,

    Please advise.

    Thanks
    Umer

    #2
    Hello Umer,

    Thank you for your note.


    Unfortunately, NinjaScripts do not have any inter-communication ability.

    However, I agree that this would be a good feature to include. I am going to submit this feature request to our Development department.
    Thank you for your suggestion for the improvement of NinjaTrader. Your feedback will be considered for a future release of NinjaTrader.


    Something that may help you toward your goal would be checking the overall account position. See the link below to a thread that discusses how to accomplish that.
    http://www.ninjatrader.com/support/f...ad.php?t=55718


    Please let me know if I can be of any other assistance.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by Master.Aurora View Post
      Hello Support,

      I am creating a strategy in which i need to do a little bit of inter-strategy communication. Here is the scenario:

      I will have multiple instances of the same strategy running simultaneously on same and/or different instruments with same and/or different parameter settings. I need to achieve a stop & reverse feature whereby if the program is Long with Strategy 1 and before the position is closed, Strategy 2 signals a Short trade, we would like for the program to Close the LONG position and Initiate the SHORT one.

      Now what i dont understand is how to make the communicate between Strategy 1 & Strategy 2 so that i can code this feature. For reference, i am using the unmanaged approach for orders in my strategy,

      Please advise.

      Thanks
      Umer
      So why not just code both strategies into one class, and do the StopAndReverse right in there?

      Comment


        #4
        Originally posted by koganam View Post
        So why not just code both strategies into one class, and do the StopAndReverse right in there?
        I guess you missed it in my original post so i will explain again. There is one strategy that i need to run on different instruments & with different parameters

        Comment


          #5
          Originally posted by Master.Aurora View Post
          I guess you missed it in my original post so i will explain again. There is one strategy that i need to run on different instruments & with different parameters
          Of course. So the strategy that is causing the reversal may have different parameters. Oops. Forgive my denseness, please.

          Comment


            #6
            Originally posted by NinjaTrader_ChelseaB View Post
            However, I agree that this would be a good feature to include. I am going to submit this feature request to our Development department.
            Thank you for your suggestion for the improvement of NinjaTrader. Your feedback will be considered for a future release of NinjaTrader.
            Thank you for your reply. Yeah, i would love to see this in the near future as it is a very important feature that is integral part of a lot of trader's strategies.

            Thanks
            Umer

            Comment


              #7
              Hello Umer,

              I wanted to let you know that I have received a tracking ID from our development department regarding your request to see the position and other information for other instances of running strategies.

              Your request is being tracked with ID #1002. Thank you again for your suggestion to improve NinjaTrader. Your suggestion will be considered for a future release of NinjaTrader.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello Umer,

                I wanted to let you know that I have received a tracking ID from our development department regarding your request to see the position and other information for other instances of running strategies.

                Your request is being tracked with ID #1002. Thank you again for your suggestion to improve NinjaTrader. Your suggestion will be considered for a future release of NinjaTrader.
                Thank You ChelseaB.

                In the meanwhile, we created an out of the box solutions for this problem. I wrote a blog post about it. Here is the link to it:



                Please feel free to spread this to other people looking to find a solution to their problems (like me) so that they have something to work with until NT has the feature built into it

                Thanks Again.
                Umer

                Comment


                  #9
                  Hello Master.Aurora,

                  Thank you for the link to this work.

                  I find this highly interesting and will be trying this myself tonight.

                  Thank you very much for doing this work and for providing the method to other users!
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_ChelseaB View Post
                    Hello Master.Aurora,

                    Thank you for the link to this work.

                    I find this highly interesting and will be trying this myself tonight.

                    Thank you very much for doing this work and for providing the method to other users!
                    Heed the warning about using static variables. Especially if there is no lock in place to handle attempts by multiple threads to update the same values, while other threads are reading those values.

                    Comment


                      #11
                      koganam,

                      Thank you for the tip. I will be very careful as I put this together.

                      As always, you are a big help. Keep up the good work.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by koganam View Post
                        Heed the warning about using static variables. Especially if there is no lock in place to handle attempts by multiple threads to update the same values, while other threads are reading those values.
                        Yeah i understand the pitfalls involved in this approach. But if you read my article, i only scribbled down an algorithm. In my implementation, i did actually take many precautionary measures

                        Anyways, thanks for pointing it out. I will add it to the article as well

                        Regards
                        Umer

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by jxs_xrj, 01-12-2020, 09:49 AM
                        6 responses
                        3,290 views
                        1 like
                        Last Post jgualdronc  
                        Started by Touch-Ups, Today, 10:36 AM
                        0 responses
                        8 views
                        0 likes
                        Last Post Touch-Ups  
                        Started by geddyisodin, 04-25-2024, 05:20 AM
                        11 responses
                        61 views
                        0 likes
                        Last Post halgo_boulder  
                        Started by Option Whisperer, Today, 09:55 AM
                        0 responses
                        8 views
                        0 likes
                        Last Post Option Whisperer  
                        Started by halgo_boulder, 04-20-2024, 08:44 AM
                        2 responses
                        24 views
                        0 likes
                        Last Post halgo_boulder  
                        Working...
                        X