Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help using pivots in a strategy

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

    Help using pivots in a strategy

    I’m hoping one of you experienced programmers can help me with this. I’m working with the indicator CMIPivotsDaily_V73 in a strategy and I’m trying to create a user input to substitute for R1, R2, etc. at the appropriate place in the code for an Exit condition, so that I can chose which pivot I want to target from the strategy dialog when I launch it. To a novice coder like me without formal training, it would seem straightforward to create a user defined string variable to use in the substitution, but when I try to compile my code for this I get the CS0117 error: “NinjaTrader.Indicator.CMIPivotsDaily_V73 does not contain a definition for ‘pivot Target’.

    What do I need to do? Here are the relevant code bits:

    #region Variables
    privatestring pivotTarget = @"Pivot"; // Temorary default. Actual input choices: R3, R2, R1, PP, S1, S2, S3

    // Condition set 2 for Long Exit
    if (High[0] >= CMIPivotsDaily_V73(10, false, PlotAlignPD.Left, HLCCalculationMode.CalcFromIntradayData, true, 15).“pivotTarget”[0])
    {
    ExitLong("ExitLongPivot", "EnterLong");
    }

    #region Properties
    [Description("Choices: R3 R2 R1 PP S1 S2 S3")]
    [Category("Parameters")]
    publicstring PivotTarget
    {
    get { return pivotTarget; }
    set { pivotTarget = value; }
    }

    #2
    That won't fly.

    You could try using a switch instead. If your string says R2, then use a code branch that goes CMIPivotsDaily_V73(10, false, PlotAlignPD.Left, HLCCalculationMode.CalcFromIntradayData, true, 15).R2[0].
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I was hoping there'd be a short cut! But ok, good to know that. I'll use switch. Thanks, Josh.

      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