Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

One order per bar

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

    One order per bar

    Hi,
    I would have only one execution (entry long / short / stop loss ) per bar, I'm trying to use IsFirstTickOfBar, in historical data seems to work, but doesn't work while the bar is creating
    I use Calculate.OnEachTick, a bool var bExe

    this is my code

    On bar update

    if (IsFirstTickOfBar)
    bExe = true;

    if (Position.Quantity == 0 && bEsegui) {
    enter position and set stop loss
    bExe = false
    else
    if (bExe and other condition)
    set stop loss

    When the stopp loss is performed in last bar I want the enter position on the next bar

    #2
    Hi,
    just understood and solved the issue!

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CaptainJack, 05-29-2026, 05:09 AM
    0 responses
    163 views
    0 likes
    Last Post CaptainJack  
    Started by CaptainJack, 05-29-2026, 12:02 AM
    0 responses
    82 views
    0 likes
    Last Post CaptainJack  
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    125 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    206 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    184 views
    0 likes
    Last Post CarlTrading  
    Working...
    X