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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        63 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