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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      663 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      376 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      110 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      575 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      580 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X