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

{NinjaScript} NT8 - Unmanaged Approach - Long and Short trades same time

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

    {NinjaScript} NT8 - Unmanaged Approach - Long and Short trades same time

    Dear all, hope you are fine.
    Im looking to open a long and a short at same time (same size) and doesnt works.
    If I open long and short with diferent sizes, only see a trade with the size of the difference.
    I need to have a Short and a Long independent each other (hedging strategy).
    How can I make this?
    I need to handle de lots in each trade specific. im using unmanaged approach.

    #2
    Hello fscabrera03,

    Thanks for your post.

    Accounts cannot go long and short at the same time. If one strategy goes long when the other goes short, the account will be flat.

    If you want to go long and short at the same time, you will need separate accounts. You can ask your broker to set up linked accounts with your login credentials to have two accounts where you may then apply a long strategy to Account A and a short strategy to Account B.

    If you want to have the scripts communicate with eachother, you can use static variables in an addon. Please note that while it is possible to have the strategies write to the same variables, this is an out-side-of-the-box idea that is not standard with NinjaScript.



    I have removed your two other posts that ask the same question in very old threads. If you have additional questions, please reply to the active thread here.

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Thank you Jim.
      So..... I need 2 different accounts one to long trades and another for short trades? I run the strategies with playback connection that generates one account on the moment of the execution.
      How can I get 2 different playback accounts?

      If I have 2 scripts comunicating each other I need to have 2 accounts too?
      I dont see why ninja trader works like that, Brokers provides specifics hedge accounts to make that.

      Comment


        #4
        Hello fscabrera03,

        Your understanding is correct. NinjaTrader does not support hedge accounts, so you need 2 accounts in order to go long and short at the same time, and any inter-strategy communication would need to be done by means to have the strategies read and write information to the same location. Static variables in an AddOn would be one idea and having the strategies read/write to file would be another idea.

        We are not yet be able to create multiple Playback accounts, and this is something that we are tracking interest behind in a feature request. The ticket ID is SFT-1688 and I have added a vote on your behalf. This is an internal number, but for anyone else wishing to have their interest tracked, please let our support staff know that you would like a vote added for this request.

        Feature Request Disclaimer

        We receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing.

        When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number will be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

        Release Notes - https://ninjatrader.com/support/help...ease_notes.htm


        Please let us know if you have any additional questions.
        JimNinjaTrader Customer Service

        Comment


          #5
          Ok Jim, thank you,
          I think I cannot use strategy analizer using 2 accounts, is that right?
          The only idea I have is tu run my long strategy in a playback connection one time, run my short strategy and export both stadistics to excel and merge them...
          So manually but...
          Hoping you can resolve that situation in future release.
          Thank you again

          Comment


            #6
            Hello fscabrera03,

            Your best way forward to have the strategies tested at the same time and to also be able to test any inter-strategy communication would be to utilize multiple Sim accounts and test with realtime data. The Strategy Analyzer does not implement a true account and would not have support for backtesting multiple strategies at the same time against multiple backtest accounts.

            If the strategies do not need to communicate with each other, yes, you could move forward testing the short/long strategies individually in the Strategy analyzer or in Playback, and then merging the results after the backtests complete.

            We have another pending feature request for "Portfolio level backtesting" which would have more complete support for accounts. The ticket ID is SFT-137. I have added a vote for you there and I have also noted your interest in backtesting multiple strategies on separate backtest accounts.

            We look forward to assisting.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ZenCortexHurry, Today, 01:07 PM
            0 responses
            2 views
            0 likes
            Last Post ZenCortexHurry  
            Started by ZenCortexHurry, Today, 01:04 PM
            0 responses
            1 view
            0 likes
            Last Post ZenCortexHurry  
            Started by f.saeidi, Today, 12:14 PM
            3 responses
            9 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Russ Moreland, Today, 12:54 PM
            1 response
            3 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by philmg, Today, 12:55 PM
            1 response
            4 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Working...
            X