Announcement

Collapse
No announcement yet.

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 fmcap, Today, 10:49 PM
        0 responses
        2 views
        0 likes
        Last Post fmcap
        by fmcap
         
        Started by iradielt, Today, 10:06 PM
        0 responses
        2 views
        0 likes
        Last Post iradielt  
        Started by gbajaj, Today, 03:35 PM
        2 responses
        11 views
        0 likes
        Last Post gbajaj
        by gbajaj
         
        Started by space_trader, Today, 03:19 PM
        2 responses
        8 views
        0 likes
        Last Post space_trader  
        Started by max1ci6, Today, 02:02 AM
        4 responses
        28 views
        0 likes
        Last Post joromero  
        Working...
        X