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

number of operations

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

    number of operations

    Hello,

    Is there a way to limit the number of trades to a determined level?I mean, I know you can limit the number of trades in an instrument such as for example:

    if (Bars.FirstBarOfSession)
    {
    Previoustrades = Performance.AllTrades.Count;
    }
    If( Performance.AllTrades.Count - Previoustrades >=NTrades)
    {return
    }

    But for example if I hace the same strategy running in 15 instruments and I would like that even in 10 of them the conditions to open a condition are true but I just want 3 open positions per day, is that possible?

    Thanks

    Sincerely

    #2
    Hello,

    There is no cross communication between strategy instances, so there would not be a supported method to check how many trades a strategy has taken, or to check how many positions are currently open.

    The only workaround would be to count the number of trades taken to an external file and then ask the strategy to read this file to determine how many total trades has been taken for that particular day.
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ZenCortexCLICK, Today, 04:58 AM
    0 responses
    5 views
    0 likes
    Last Post ZenCortexCLICK  
    Started by sidlercom80, 10-28-2023, 08:49 AM
    172 responses
    2,280 views
    0 likes
    Last Post sidlercom80  
    Started by Irukandji, Yesterday, 02:53 AM
    2 responses
    18 views
    0 likes
    Last Post Irukandji  
    Started by adeelshahzad, Today, 03:54 AM
    0 responses
    8 views
    0 likes
    Last Post adeelshahzad  
    Started by Barry Milan, Yesterday, 10:35 PM
    3 responses
    13 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Working...
    X