Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

SetStopLoss or SetProfitTarget Per Specific Unique Entry

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

    SetStopLoss or SetProfitTarget Per Specific Unique Entry

    Is it possible for me to Enter a trade and tie a particular stoploss (or profittarget) to it.

    e.g.

    EntryHandling is set to "UniqueEntries"
    Entries Per Direction is set to 2

    EnterShort(1,"Trade1"); e.g. ENTERS @ 5290
    SetStopLoss(CalculationMode.Price,5300); ** TIE THIS TO "Trade1" **

    EnterShort(1,"Trade2"); e.g. ENTERS @ 5280
    SetStopLoss(CalculationMode.Price,5290); ** TIE THIS TO "Trade2" **

    then later on

    move stop for "Trade1" to another price
    move stop for "Trade2" to another price

    etc etc.

    Is this "tie" of Stop Losses / Profit Targets to specific trades possible ?

    Many Thanks


    #2
    Hello markyb0y,
    Yes, you can do so using the below overload.
    Code:
    SetStopLoss(string fromEntrySignal, CalculationMode mode, double value, bool simulated)
    Please refer to our help guide to know more.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Absolutely brilliant!!

      unbelievably quick response.

      Many Thanks!!

      Comment


        #4
        pair up the Stop with the Entry

        Given :

        tradeidno=1;
        EnterShort(contractspertrade,tradeidno.ToString()) ;
        SetStopLoss(tradeidno.ToString(),CalculationMode.T icks,10,true);


        When I outpur the orders in OnOrderUpdate I get :

        The order name 1 stop price is currently 0 **** EnterShort ****
        The order name Stop loss stop price is currently 5542 ** SetStopLoss **

        If I add more stop losses it names them all "Stop loss"

        tradeidno++;

        The order name 2 stop price is currently 0
        The order name Stop loss stop price is currently 5548

        Order='NT-00001/Backtest' Name='Stop loss' State=Working Instrument='Z 09-12' Action=BuyToCover Limit price=0 Stop price=5542 Quantity=1 Strategy='BuildTradingPlan' Type=Stop Tif=Gtc Oco='NT-00000-467' Filled=0 Fill price=0 Token='e36ca3e3254e4a099cda7e8a0010fc36' Gtd='01/12/2099 00:00:00'
        Order='NT-00003/Backtest' Name='Stop loss' State=Working Instrument='Z 09-12' Action=BuyToCover Limit price=0 Stop price=5548 Quantity=1 Strategy='BuildTradingPlan' Type=Stop Tif=Gtc Oco='NT-00001-467' Filled=0 Fill price=0 Token='062f21940b5d43ceadd1d2a337786755' Gtd='01/12/2099 00:00:00'

        Is this correct?

        I need to be able to pair up the Stop with the Entry.

        How can this be done?

        Comment


          #5
          Hello markyb0y,
          Orders submitted by the SetStopLoss will be marked as "Stop Loss".

          Instead of looking for the order name please print out the values of the FromEntrySignal property to know from which entry order your stop was "tagged" with.

          Code:
          e.Order.FromEntrySignal
          JoydeepNinjaTrader Customer Service

          Comment


            #6
            Thanks Again for you speedy reply
            :-)

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
            55 responses
            5,450 views
            0 likes
            Last Post BartMan
            by BartMan
             
            Started by DawnTreader, 05-08-2024, 05:58 PM
            16 responses
            52 views
            0 likes
            Last Post DawnTreader  
            Started by tradingnasdaqprueba, 05-07-2024, 03:42 AM
            15 responses
            60 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by kevinenergy, Yesterday, 12:01 PM
            8 responses
            28 views
            0 likes
            Last Post kevinenergy  
            Started by nightstalker, Today, 01:32 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Working...
            X