Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Limit to one trade

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

    Limit to one trade

    Hi guys
    How do I make my strategy limited to one trade every day, either Long trade or short trade.
    it should only make one trade a day, if that trade was closed, the strategy doen't open new trades even if the other conditions are true.

    #2
    Hello onlinebusiness,

    Thank you for your post.

    One way to achieve this is to set a bool, something like tradeTaken for example, that defaults to false. Once the trade happens, set the bool to true. Your entry condition can check so that it only happens for your entry criteria as well as if the bool is false such as the following:

    if (tradeTaken == false && // other entry criteria)
    // submit entry order

    You could reset the bool at the beginning of the day with something like the following:

    if (Bars.IsFirstBarOfSession)
    tradeTaken = false;

    If you prefer to have your strategy completely halted after one trade is taken, I recommend following the ideas in the following reference sample that checks for a certain PnL, then it will cancel active orders and close active positions, then halt the strategy:


    Please let us know if we may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    65 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    139 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X