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

Access external strategy

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

    Access external strategy

    Hi

    Suppose I have 10 strategies independent that only go long and 10 independent strategies that only go short. Independent is defined as= strategies that were created separately and have their own .cs files within nt8.

    Now suppose I want to create a new strategy that says:

    If long bool = true
    {activate all 10 long strategies}

    Else if short bool = true
    {activate all 10 short strategies}

    Basically what I'm trying to do is, define a "long" market environment and if the conditions for the "long" market environment are true, it will make my long bool = true, and then I can enter long in all of my independent strategies based on their individual rules of entry and trade management.

    I could copy and paste the "defined" long market condition into each individual strategy but I was thinking this would be better.

    How can I access strategies within a strategy?

    Another question

    Suppose I have 10 strategies that are live and are independent of one another. They all follow different entry and exit rules. However, some of the strategies may have identical entry and exit names. For example "entry1" or "target1" etc. I have not noticed any issues and want to confirm that this shouldn't cause any issues? I don't want nt8 to get confused.

    Thanks
    Last edited by staycool3_a; 12-25-2017, 02:08 AM.

    #2
    Hello,

    Thank you for the post.

    It is not possible to start a strategy from another strategy. The solution would be to unify the logic of all of these strategies into one strategy. Then you could control all trading from booleans. Even if your strategies use different time frames and instruments, NinjaScript will support this.

    https://ninjatrader.com/support/help...nstruments.htm - Multi-Time Frame & Instruments

    For your second question, using the same string will not cause issues. NinjaTrader will associate entries/exits from instruments individually. When entering orders for a multi-instrument script, use the overload that takes a BarsinProgress. The EnterLong() method, for example:

    Code:
    EnterLong([B]int barsInProgressIndex[/B], int quantity, string signalName)
    The strategy position that all of your strategies hold will keep the strategies separate from each other.

    Please see this help guide page on Strategy Position vs. Account Position



    Please let us know if you have any questions.
    Chris L.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by funk10101, Today, 12:02 AM
    0 responses
    1 view
    0 likes
    Last Post funk10101  
    Started by gravdigaz6, Yesterday, 11:40 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by MarianApalaghiei, Yesterday, 10:49 PM
    3 responses
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by XXtrader, Yesterday, 11:30 PM
    0 responses
    4 views
    0 likes
    Last Post XXtrader  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    28 views
    0 likes
    Last Post love2code2trade  
    Working...
    X