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

Can't set 2 entries in one set

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

    Can't set 2 entries in one set

    Hi!

    I try to set 2 entries at the same time in NT8 Strategy Builder but I can't manage it.
    I have done it like in "Using multiple entry/exit signals simultaneously" and other online tutorials described, but had no success.

    EntriesPerDirection=10
    EntryHandling tried both settings

    Here's the Code from Strategy Builder Set1:

    // set 1
    if (Times[0][0].TimeOfDay == EntryTime.TimeOfDay)
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), @"Short1");
    EnterShort(Convert.ToInt32(DefaultQuantity), @"Short2");

    Is there something wrong?

    Thank you!

    #2
    Hello esteban_rojo,

    Thank you for your note.

    With the following two settings you should have no issue with the entry statements of your code.

    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.UniqueEntries;

    Please run the attached script on a 5 second ES chart. Are you seeing two entries?

    To Import a NinjaScript into NinjaTrader 8 do the following:
    From the Control Center window select Tools -> Import-> NinjaScript...
    Find the file location.

    I look forward to your reply.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Thank you AlanP!

      It works now.

      I have another question.
      Is it somehow possible to do the following in NT8 Strategy Builder?

      After I bought 2 positions with different signal names I set a hard stop for both positions
      Then I want to close one position with a profit target and the second one with an indicator and the "Exit" command.
      In principle it is no problem to do that but I want to activate the indicator exit just after the profit target was triggered.

      Is this possible? Maybe with a bool variable or something?
      Or is there an option to say: do it after there is only one position left?

      Thank you in advance!

      Comment


        #4
        Hello esteban_rojo,

        Perhaps. You may be able to set a bool to true when you are short/long 2 contracts. Then if that bool is true, if current position then becomes 1 contract, meaning one contract was sold, set another bool to true. If that bool is true, you could then start checking for your exit logic.

        Please let us know if you need further assistance.
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by BarzTrading, Today, 07:25 AM
        2 responses
        26 views
        1 like
        Last Post BarzTrading  
        Started by devatechnologies, 04-14-2024, 02:58 PM
        3 responses
        20 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by tkaboris, Today, 08:01 AM
        0 responses
        5 views
        0 likes
        Last Post tkaboris  
        Started by EB Worx, 04-04-2023, 02:34 AM
        7 responses
        163 views
        0 likes
        Last Post VFI26
        by VFI26
         
        Started by Mizzouman1, Today, 07:35 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X