Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Auto Breakeven

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

    Auto Breakeven

    Hello,
    Just having a play with my first bit of backtesting... how would i amend the below to move the stop to b/e if the price hits +25 ticks?

    Any help greatly appreciated

    Code:
            
    protected override void Initialize()
            {
                SetStopLoss("", CalculationMode.Ticks, 25, false);
                
                SetProfitTarget("", CalculationMode.Ticks, 36);
    
                CalculateOnBarClose = true;
    
            }

    #2
    Hello,

    You will need to move the SetStopLoss("", CalculationMode.Ticks, 25, false); out of the Initialization block and into the OnBarUpdate block, build your criteria for move the stop, then call the SetStopLoss again with new placement.

    This link may help:
    http://www.ninjatrader-support2.com/...ead.php?t=3222
    DenNinjaTrader Customer Service

    Comment


      #3
      thanks that works a treat

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by bortz, 11-06-2023, 08:04 AM
      47 responses
      1,603 views
      0 likes
      Last Post aligator  
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      8 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      4 views
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      12 views
      0 likes
      Last Post Javierw.ok  
      Working...
      X