Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

HOW!!?? Turn SetStopLoss into a ExitLongLimit

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

    HOW!!?? Turn SetStopLoss into a ExitLongLimit

    Greets!

    I have (for me) intriguing idea after taking a long look at how the SetStopLoss was having my automated strategy trades finish: it looks like there could be another 3 or more ticks of profit .
    I tried just adding another 3 ticks to the calculation I was using, with a small amount of success (ie same# of trades are taken, small increase in net points) but if I try to make the process into a ExitLongLimit the results are not any more fruitful

    // Adjust TrailLong Exit


    double TRAILtickAdjustLONG = 0;
    //

    if ( (BarsSinceEntry(0, "",0)) >= iTrailStartBarNum )
    {
    // Rule#1 uptrending flat for 3 bars in a row

    if( iTrailUseTSr1 == 1 && sTrailSS[0] == 1 && vTrailCt >= 3)
    TRAILtickAdjustLONG++;
    // Rule#2 uptrending flat for 2 bars in a row

    if( iTrailUseTSr2 == 1 && sTrailSS[0] == 1 && vTrailCt >= 2)
    TRAILtickAdjustLONG++;
    // Rule#3 EXIT DOWNtrending

    if( iTrailUseTSr3 == 1 && sExitSS[0] == -1)
    TRAILtickAdjustLONG++;

    //

    tVars.cStopLossTicks -= TRAILtickAdjustLONG;
    // this is the code I substituded for the SetStopLoss() line

    // if ( Low[0] <= (Position.AvgPrice - tVars.cStopLossTicks * vTickMult))

    // ExitLongLimit( (Position.AvgPrice - tVars.cStopLossTicks * vTickMult) + 3*TickSize);


    SetStopLoss(CalculationMode.Ticks, tVars.cStopLossTicks * vTickMult + 3*TickSize);
    }
    }

    Any suggestions on how this can be coded effectively? My guess is that this may apply to several people that use SetStopLoss.

    TIA!
    Jon
    Last edited by Trader.Jon; 03-23-2011, 05:22 PM.

    #2
    Hi Jon, I'm not 100 % I follow you - you will very likely not see the same results comparing the same price using SetStopLoss to ExitLongLimit, as one is a Stop Market order and the other a Limit order, which might or might not fill thus giving you a different trade sequence.

    Comment


      #3
      Bertrand,

      Thanks for the response! I am aware of those possibilities.

      In my eyeball of the charts I see the price more likely to move up a little on the next bar before either continuing upwards & then continuing to fall on the next following bar. I am trying to have the SetStopLoss put in 'suspension', ie more as a trigger for the ExitLongLimit() ... if price goes up to the calculated limit price it is good ... if it falls instead then there is another condition that will be hit on the following bar to exit the trade.

      I obviously wont know which is better until I can test it over a period of time.

      I am unable to just add the extra 3 or so ticks onto just every SetStopLoss because it gets triggered too soon. SO ...
      if ( setstoploss == 1.4400 && low falls to 1.4399 )
      { make ExitLongLimit( 1.4400 + 3*ticksize
      OR
      ???
      }

      How can I 'grab' the current stoploss value when the bar is updated?

      OR ... are you saying what I have already written is likely the only good solution and it just isnt likely to make much difference?

      Any ideas?

      Jon
      Last edited by Trader.Jon; 03-24-2011, 10:22 AM.

      Comment


        #4
        This section looks funny. The second block WILL always execute if the first one does, as the first condition implies that the second condition must also be true. Did you really intend for the double increment in TRAILtickAdjustLONG?

        if( iTrailUseTSr1 == 1 && sTrailSS[0] == 1 && vTrailCt >= 3)
        TRAILtickAdjustLONG++;
        // Rule#2 uptrending flat for 2 bars in a row

        if( iTrailUseTSr2 == 1 && sTrailSS[0] == 1 && vTrailCt >= 2)
        TRAILtickAdjustLONG++;
        // Rule#3 EXIT DOWNtrending

        Comment


          #5
          koganam,

          the 'iTrailUse ...' are basically enums that are optimized against. As you noticed, I include both, and this is to see which works best

          Jon

          Comment


            #6
            Jon, you could 'grab' the SetStopLoss's with the ideas presented here - http://www.ninjatrader.com/support/f...ead.php?t=5790

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            650 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            574 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            577 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X