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 ETFVoyageur, Today, 04:00 PM
            0 responses
            5 views
            0 likes
            Last Post ETFVoyageur  
            Started by AaronKTradingForum, Today, 03:44 PM
            1 response
            6 views
            0 likes
            Last Post AaronKTradingForum  
            Started by Felix Reichert, 04-26-2024, 02:12 PM
            11 responses
            77 views
            0 likes
            Last Post Felix Reichert  
            Started by junkone, 04-28-2024, 02:19 PM
            7 responses
            82 views
            1 like
            Last Post junkone
            by junkone
             
            Started by pechtri, 06-22-2023, 02:31 AM
            11 responses
            136 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Working...
            X