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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    137 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    72 views
    0 likes
    Last Post PaulMohn  
    Working...
    X