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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 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