Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to reset set Profit Target

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

    How to reset set Profit Target

    I want to set SetProfitTarget("", CalculationMode.Percent, stopGainNumber); depending on some inyrday condition.. Meaning that, sometimes the strategy will work with no SetProfitTarget and due to some condition "triggered" it will begin working with some.

    My problem is when SetProfitTarget is set up, and then, I need to reset the strategy to no SetprofitTarget.

    How can I reset it, once I comand this:.

    SetProfitTarget("", CalculationMode.Percent, stopGainNumber);

    ??

    #2
    Hello dafonseca,

    Thank you for your post.

    Unfortunately, this would not be possible. You would instead need to use an Exit() method: http://www.ninjatrader.com/support/h...d_approach.htm

    Comment


      #3
      Hi dafonseca,

      I have the same situation, I use different target / stops. It's a way:

      #region Variables
      private double percentTarget = 99; // Default setting for PercentTarget
      private double percentStop = 99; // Default setting for PercentStop
      #endregion

      protected override void Initialize()
      {
      SetProfitTarget("", CalculationMode.Percent, percentTarget);
      SetStopLoss("", CalculationMode.Percent, percentStop, false);
      CalculateOnBarClose = true;
      }


      protected override void OnBarUpdate()
      {
      if
      ( (ToTime(Time[0]) >= 080000) && (ToTime(Time[0]) <= 093059) ||
      (ToTime(Time[0]) >= 094700) && (ToTime(Time[0]) <= 142659) ) /*use your intraday condition, e.g. timeframes*/
      {
      percentStop = 0.0025;
      percentTarget = 0.0021;
      //Print(Time[0].ToString() );
      }
      else
      {
      percentStop = 99;
      percentTarget = 99;
      }


      // Now Trading
      if (CrossAbove(Close, ParabolicSAR(Acc, AccMax, AccStep), 1 /*use your trading conditions*/))
      {
      EnterShort(DefaultQuantity, "ShortTrader");
      SetProfitTarget("", CalculationMode.Percent, percentTarget);
      SetStopLoss("", CalculationMode.Percent, percentStop, false);
      }

      }

      Torso
      Last edited by Torso; 04-28-2014, 05:30 AM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      65 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      51 views
      0 likes
      Last Post CarlTrading  
      Working...
      X