Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Stop loss errors

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

    Stop loss errors

    Hi Guys,

    I am having a problem with multiple entires. When I use the term Firstentry it sets the stop to my entry price not the danchain chanel low. If I dont use the entry name it ignores the stop. If I dont use an entry name when I enter its ok.

    Code:
     
    // If a long position is open, allow for stop loss modification to breakeven
    else if (Position.MarketPosition == MarketPosition.Long)
    {
    
    barcounter = barcounter +1 ;
    if (DonchianChannel(stoptrail).Lower[1]> Position.AvgPrice)
    { 
    SetStopLoss("Firstentry", CalculationMode.Price, DonchianChannel(stoptrail).Lower[1] - stoptrailoffset* TickSize , false);
    //SetStopLoss("Secondentry", CalculationMode.Price, DonchianChannel(stoptrail).Lower[1] - stoptrailoffset* TickSize , false);
    //Print("Firstentry last value= "+(DonchianChannel(stoptrail).Lower[1] - stoptrailoffset* TickSize) + " " + Close[0]+ " " +(Time[0].ToString()) );
    }
    }


    Attached Files

    #2
    raefon,

    The "Firstentry" would tie that stop loss to the entry that has entrance signal string "Firstentry".

    What is stoptrailoffset? How is it defined?
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Stoptrailoffset is a private int variable. Its an offset below the low period. Its the entry name that seems to be the problem however.

      Comment


        #4
        raefon,

        Could you post more of our code?
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          attached as zip
          Attached Files

          Comment


            #6
            hi am get some problem in stop loss

            hi,
            am also get some problem in stop loss.how may i solve this .

            Comment


              #7
              raefon,

              DonchianChannel(stoptrail).Lower[1]> Position.AvgPrice

              The DonchainChannel is not necessarily greater than the Position.AvgPrice initially. You would want to set an initial stop loss before you enter the trade.
              Adam P.NinjaTrader Customer Service

              Comment


                #8
                ramfx,

                If you could post your code I'd be happy to take a quick look.
                Adam P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                647 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                368 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                108 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                571 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                573 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X