Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

single order on trend change

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

    single order on trend change

    Hello, I would need help to finalize this strategy: it is based on the change of market trend but I want only one order to be taken with each change of position: how to do ?I can not do it. Thank you
    Attached Files

    #2
    Hello 270027,

    The script you have provided was exported as an assembly, so we are not able to view the code.

    To only allow one order to be taken, you can check the position to be flat before allowing an entry.

    if (Position.MarketPosition != MarketPosition.Flat)
    {
    EnterLong();
    }

    You could also use bools to control this behavior as well. Once the order is submitted, set a bool to true. When the position is flat or an exit order is filled, set the bool back to flat. Require the bool to be false to allow an entry.

    Last, you could control this by assigning orders to variables and checking the order state, or checking to see if the variable is null.
    Below is a link to an example.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      voici le fichier non assemblé
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      51 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      127 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X