Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Entry Bar return

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

    Entry Bar return

    Hello!

    How can I get Enter Position Bar in my strategy?
    Want to create next thing:
    When position is going +10 ticks in my side -> set stop loss on the high/low of the bar, where was an entry in position.

    Thanks!

    #2
    Hello YevhenShynkarenko,

    To find when the price has increased, save the trigger price to a variable. Then compare the current price to that variable.

    For example:
    private double triggerPrice = 0;
    if (/* conditions to enter trade */)
    {
    SetStopLoss( "entryOrder", CalculationMode.Ticks, 10, false );
    EnterLong( "entryOrder" );
    triggerPrice = Close[0] + 10 * TickSize;
    }

    if (Position.MarketPosition == MarketPosition.Long && Close[0] >= triggerPrice)
    {
    SetStopLoss( "entryOrder", CalculationMode.Price, Position.AvgPrice, false );
    }

    This code sets the triggerPrice variable to the current price plus 10 ticks (Close[0] + 10 * TickSize). Once the current price is equal or greater than the saved price the stop loss is set to the position entry price.

    I am also attaching a more complicated example script that demonstrates movements in OnBarUpdate and movements in OnMarketData() with a slightly different approach.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    559 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    546 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X