Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

basic stop loss question

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

    basic stop loss question

    how do I add a stop loss to my code below, that will place a stoploss 10 ticks below my long entry price? I want a 10 tick profit target which works and I want a 10 tick stop loss below my entry price? help please!

    EnterLong(DefaultQuantity, "");
    profitfactor = 2;
    EntryPrice = Position.AvgPrice;
    Print(EntryPrice);
    SetProfitTarget(CalculationMode.Ticks, 10);

    #2
    James, you can work with SetStopLoss() in the Initialize() if you want a static 10 tick stop - http://www.ninjatrader-support.com/H...tStopLoss.html
    BertrandNinjaTrader Customer Service

    Comment


      #3
      I was after the code to be honest, not an example sorry do you have the line of code?

      Comment


        #4
        Just add SetStopLoss(CalculationMode.Ticks, 10) in the Initialize() of your strategy.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          how do I make a stop loss that will stop when

          market entry price - profitfactor * ATR(22)[0];

          the code is below,

          EnterLong(DefaultQuantity, "");
          profitfactor = 2;
          EntryPrice = Position.AvgPrice;
          Print(EntryPrice);
          SetProfitTarget(CalculationMode.Ticks, 10);

          Comment


            #6
            Hello,

            One way to do this is to change the StopLoss in OnBarUpdate then instead of just changing it to 10 ticks you would change it to the value you have calculated you want the stop to be at and then put this in manually to SetStopLoss(CalculationMode.Price, Price you want stop at);

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            55 views
            0 likes
            Last Post samish18  
            Started by arvidvanstaey, Today, 02:19 PM
            3 responses
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            8 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            47 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X