Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

tagging orders with wildcards

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

    tagging orders with wildcards

    I have a strategy that gives multiple signals and orders.
    Till now I named all the orders the same, because I use only 1 way to handle all the Profit Targets, Stoploss and Trails.

    I now want to give the entry orders different names (tags) but allways with, lets say, the first 10 characters the same. Then follows a more specific tag.

    I use NT7 and a Managed Approach.

    My questions:
    1 Is it possible to work with different order tags but handle them (SL, TP, Trail) in 1 way, using wildcards to adress all the different order tags?
    2 Is it wise to work this way or is there a better way?

    Thanks in advance,
    Anne

    #2
    Hello Anne,

    Thank you for writing in.

    There is no built-in way to reference an order by the use of a wild card. The entire signal name of the order must be referenced.

    What you could do, however, is store each signal name string into a list and then just iterate through the list in order to grab each individual signal name string.

    As a quick example:
    Code:
    private IOrder order1 = null, order2 = null, order3 = null;
    List<string> signalNames;
    
    protected override void Initialize()
    {
        signalNames = new List<string>();
    }
    
    protected override void OnBarUpdate()
    {
        if (order1 == null)
        {
            order1 = EnterLong("long1");
            signalNames.Add(order1.Name);
        }
    
        if (order2 == null)
        {
            order2 = EnterLong("long2");
            signalNames.Add(order2.Name);
        }
    
        if (order3 == null)
        {
            order3 = EnterLong("long3");
            signalNames.Add(order3.Name);
        }
    }
    You can then iterate through the list to do something.

    The example below will just exit by utilizing the signal name for each entry:
    Code:
    foreach (string signalName in signalNames)
    {
         ExitLong(signalName);
    }
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Ok, thanks.

      Without having tried, is it possible to adress the order tag by a variable?
      For instance:
      EnterShort(QuantShort1, Shortnr1);
      instead of
      EnterShort(QuantShort1, "Shortnr1");

      And what are the possibilities in NT8 about more dynamic adress orders (and tags)?

      Comment


        #4
        Hello trail,

        You will be able to pass a variable containing a string.

        NinjaTrader 8 will still need the entire signalName when referring to orders.
        Zachary G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        330 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        548 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X