Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

shorting twice

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

    shorting twice

    Hi,

    I have a strategy that's make some calculations and then choose if it sould enter or no the market but some times it can say it twice which means it sell the first time and then remark that it isn't enough regarding the situation and try to short another time but here I don't know what happen: my strategy is programmed to block all it did untill the broker confirms it short. the broker never confirms the second one. I notice that I am using the setstoploss and setprofittarget methods and that I am naming each trade distinctly.

    Thank you for your help,
    R.E.

    #2
    Hello R.E.

    Thanks for your post.

    If I understand correctly, you want to ensure that you are not already in a market position to prevent subsequent unexpected entries.

    For example:

    if (Your entry conditions && Position.MarketPosition == MarketPosition.Flat)
    {
    // enter order
    }


    So even if your entry conditions repeat, no order would be placed unless your position is flat meaning you have no open orders.

    Alternatively, or in addition to the above, you could use bool logic that you set immediately when placing an order (and not waiting for MarketPosition to be updated) and reset to prevent the 2nd entry.

    if (Your entry conditions && Position.MarketPosition == MarketPosition.Flat && doitOnce)
    {
    // enter order
    doitOnce = false; // prevent a rapid second entry
    }

    You would need to reset doitOnce back to true at a time when you are in a flat position (or opposite position) so that when your entry condition become true again you can place a new order.

    Comment


      #3
      Hi,
      Thank you for your answer, but I am trying to do the opposite. I want to make it possible to do multiple shorts but it seems to block, and I have no idea why. All I know is that is seems that the broker doesn't answer the second time I ask to short, and my strategy blocks waiting the answer.

      Thank you in advance,
      R.E.

      Comment


        #4
        Originally posted by snoppss View Post
        Hi,
        Thank you for your answer, but I am trying to do the opposite. I want to make it possible to do multiple shorts but it seems to block, and I have no idea why. All I know is that is seems that the broker doesn't answer the second time I ask to short, and my strategy blocks waiting the answer.

        Thank you in advance,
        R.E.
        What is your EntriesPerDirection value?

        Comment


          #5
          Hello R.E.,

          Thanks for your reply.

          In the case of wanting multiple order please check your "Entries per direction" parameter in the strategy user interface panel. Here is where you can find the parameters when applying the strategy to a chart. http://ninjatrader.com/support/helpG...t_strategy.htm

          Alternatively this can be set programmatically as well.


          Comment


            #6
            Thanks guys, it works fine now

            Comment

            Latest Posts

            Collapse

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