Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Only one order

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

    Only one order

    Dears,
    I am searching the way to allow only one enter position when conditions are met, or ban a second enter position as long as at least one condition has not been voided.
    Take an example with SMA : Enter a long position when price is above a rising MA, and don't enter a second long position as long as MA has not been returned.
    Thanks for your help.
    Regards​

    #2
    Hello sebdgo,

    Thank you for your inquiry.

    The EntriesPerDirection is used to control the number of entry orders that can be submitted into a position. After a position is taken to the EntriesPerDirection amount, any new entries would be ignored until the position is exited. By default this is set to 1.

    EntriesPerDirection - https://ninjatrader.com/support/help...rdirection.htm

    Another option is adding a bool that is true once you have entered a position, and add a check to make sure the bool is false in your entry condition. For example,

    Code:
    if (goingLong == false && Close[0] > SMA)
    
    {
    
    enterLong();
    
    goingLong = true;
    
    }

    You will then want to add another condition to check if MA has been returned, then you can set goingLong back to false.

    Please let us know if you have any other questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    68 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    151 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    100 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    288 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X