Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

stoploss at breakeven at T1

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

    stoploss at breakeven at T1

    Hi,

    I have a strategy- CalculateOnBarClose=false- trading 2 contracts.
    The entry orders are separated in 2 orders of 1 contract each with an unique signal. So the Profittarget and Stoploss can be set for each contract separately.
    The first contract is taken out by the profittarget for that contract.
    I move then the stoploss for the 2e contract to brealeven+1.
    The script is as follows:

    //*****************Move Stop to Breakeven+1 after T1

    if(Position.Quantity==1)
    SetStopLoss("ZLRL2",CalculationMode.Price,Position.AvgPrice+TickSize,false);

    if(Position.Quantity==-1)
    SetStopLoss("ZLRS2",CalculationMode.Price,Position.AvgPrice-TickSize,false);

    However it looks like that the original stoploss is still valid.
    I assumed that Position.AvgPrice is the average entry price of the 2 contracts.

    Could you pls tell me what I am doing wrong?

    #2
    Right, you would need to "invalidate" the SetStopLoss setting, since it stays effective once you called it. We'll look into and let you know.

    Comment


      #3
      Dierk,

      Could you pls confirm that Position.AvgPrice the entry price is.
      In the documentation I could not find any reference to an entry price.

      Comment


        #4
        That is correct.

        Comment


          #5
          Dierk,

          For the original setting of the stoploss I use the following script

          if(Position.MarketPosition==MarketPosition.Flat)
          {
          SetStopLoss("ZLRL1",CalculationMode.Ticks,Stoploss1,false);
          SetStopLoss("ZLRS1",CalculationMode.Ticks,Stoploss1,false);
          SetStopLoss("ZLRL2",CalculationMode.Ticks,Stoploss2,false);
          SetStopLoss("ZLRS2",CalculationMode.Ticks,Stoploss2,false);
          }

          and for the new setting I use

          //*****************Move Stop to Breakeven+1 after T1

          if(Position.Quantity==1)
          SetStopLoss("ZLRL2",CalculationMode.Price,Position.AvgPrice+TickSize,false);

          if(Position.Quantity==-1)
          SetStopLoss("ZLRS2",CalculationMode.Price,Position.AvgPrice-TickSize,false);


          Might it be possible that a stoploss can not be changed when the original setting uses

          CalculationMode.Ticks

          while the reset of the stoploss uses

          CalculationMode.Price

          Comment


            #6
            Changing the CalculationMode should work. I suggest verifying by a simple a possible strategy (only one entry).

            Comment


              #7
              Hi,

              Is there anybody out here who - trading two contracts -has developed a working exit strategy,where the stoploss is moved to breakeven the moment the first contract is taken out at T1.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              105 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              53 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              35 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              38 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              74 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X