Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set Stop Loss to Entry Name

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

    Set Stop Loss to Entry Name

    Hello. I am looking a work around to achieve the following:
    ExitLongStopMarket("Long 1a", CalculationMode.Ticks, 100);
    thanks in advance

    #2
    Hello crossbones,

    Welcome to the NinjaTrader forums!

    If you are in a position created with "Long 1a", you could have something similar to:

    Code:
    if (Position.MarketPosition == MarketPosition.Long)
    {
    if (stopPrice == 0)
    stopPrice = Position.AveragePrice - 100 * TickSize;
    
    ExitLongStopMarket(stopPrice, "myExit", ("Long 1a")
    }
    ExitLongStopMarket(double stopPrice, string signalName, string fromEntrySignal)
    https://ninjatrader.com/support/help...stopmarket.htm


    Below is a link to a forum post with helpful information about getting started with NinjaScript.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks for the code example. I do have a follow up question of how to do something like the below.

      if (EntrySignal("Long 1a"))
      {
      do something
      }

      Comment


        #4
        Hello crossbones,

        There is no EntrySignal() method in NinjaScript. However, you can design your own method to derive a signal and take the actions you desire.

        To get acquainted with NinjaScript, I may suggest starting with the Strategy Builder 301 tutorial and then to experiment creating strategy logic following our Conditions and Actions examples. Once you are comfortable setting up logic with these examples, you can incorporate them in a larger strategy.

        Strategy Builder 301 — https://www.youtube.com/watch?v=_KQF2Sv27oE

        Conditions examples —https://ninjatrader.com/support/help...on_builder.htm

        Actions examples — https://ninjatrader.com/support/help...us/actions.htm

        The Strategy Builder creates Managed Approach NinjaScript code, so it can also help to review our Managed Approach documentation for more information on how positions can be entered and managed.

        Managed Approach - https://ninjatrader.com/support/help...d_approach.htm

        You can then click the View Code button in the Strategy Builder to see the resulting syntax.

        We look forward to assisting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        87 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        132 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        65 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        118 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        67 views
        0 likes
        Last Post PaulMohn  
        Working...
        X