Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop Loss

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

    Stop Loss

    hello,
    I'm set Stop Loss in percentage to OnBar Update (), if the position is flat. For example:

    protected override void OnBarUpdate ()
    {
    if (Position.MarketPosition == MarketPosition.Flat)
    {
    SetStopLoss ("", CalculationMode.Price (Close [0] - (Close [0] * (1 +2))), false) ; // Stop 2%
    }

    is correct to do as above ?

    Or should I do this:

    SetStopLoss("", CalculationMode.Percent, 2, false);// Stop 2%

    or how?
    Ciao.
    Roberto

    #2
    Hello Roberto,

    You'll want to use the decimal equivalent for the value you're looking for.

    A 2% stop loss can be expressed:

    SetStopLoss("", CalculationMode.Percent, .02, false);
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks RyanM,
      I have another question.
      If I'm set the Stop Loss of 2,5 % below the purchase price, using the command Price, that's okay:
      SetStopLoss(" ", CalculationMode.Price,(Position.AvgPrice *(1 - .025)) , false);

      As for the stop of 2.5% above the purchase price, that's okay:
      SetStopLoss(" ", CalculationMode.Price,(Position.AvgPrice *(1 + .025)) , false);
      Ciao.
      Roberto

      Comment


        #4
        Yes Roberto, that math looks correct.

        Comment


          #5
          What is the difference between the set StopLoss:
          SetStopLoss ("", CalculationMode.Percent, .02, false);
          or so "", CalculationMode.Percent, .02,);Ascolta
          Trascrizione fonetica
          Ciao.
          Roberto

          Comment


            #6
            in the previous mail there are errors of transcription

            What is the difference between the set StopLoss:
            SetStopLoss ("", CalculationMode.Percent, .02, false);
            or so: CalculationMode.Percent, .02,);
            the use of false what does this mean?
            Ciao.
            Roberto

            Comment


              #7
              Roberto, the stop will be either simulated or not - means if it's simulated it will not be submitted until triggered, so you can effectively hide your stops.

              Comment


                #8
                Hello, please, ask for help because I'm stuck in this part of code.
                I created a # region OrderRouting to manage operations Long / Short,with two Breakeaven (Be1 and Be2).Working with Stoks use the percentage calculation to set the Stop.
                When you experience the conditions of 1st Breakeaven (BE1) and the AvgPrice+3%, the stop price move to AvgPrice. Second contidion,Breakeaven 2° (BE2) and the AvgPrice+5% the stop move to AvgPrice+ 3%.
                okay if I do this:

                #region OrderRouting
                private void ManagerOrder ()
                {
                if (Position.MarketPosition == MarketPosition.Long)
                {
                if( Be1 && High[0] > Position.AvgPrice * (1+0.03))
                SetStopLoss(" ", CalculationMode.Price,Position.AvgPrice, false);


                if( Be2 && High [0] > Position.AvgPrice *(1+0.05))
                SetStopLoss("LongFibonacci°", CalculationMode.Price,Position.AvgPrice*(1+0.03), false);

                or so:
                if( Be1 && High[0] > Position.AvgPrice + (Position.AvgPrice* (1+0.03)) )
                SetStopLoss(" ", CalculationMode.Price,Position.AvgPrice, false);

                Thanks for the valuable help they always give us.
                Ciao
                Roberto

                Comment


                  #9
                  Italy, can you please clarify? I'm not sure what the question is.
                  AustinNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  578 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  334 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
                  554 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  551 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X