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 charlesugo_1, 05-26-2026, 05:03 PM
                0 responses
                57 views
                0 likes
                Last Post charlesugo_1  
                Started by DannyP96, 05-18-2026, 02:38 PM
                1 response
                143 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by CarlTrading, 05-11-2026, 05:56 AM
                0 responses
                161 views
                0 likes
                Last Post CarlTrading  
                Started by CarlTrading, 05-10-2026, 08:12 PM
                0 responses
                97 views
                0 likes
                Last Post CarlTrading  
                Started by Hwop38, 05-04-2026, 07:02 PM
                0 responses
                276 views
                0 likes
                Last Post Hwop38
                by Hwop38
                 
                Working...
                X