Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy problem

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

    Strategy problem

    Hi - trying to use the strategy wizard to generate a chart signal when an oscillator (fisher) reaches a particular level. I think I tracked the example in your documentation, but i'm getting an error (CS0021 - cannot apply indexing with [] to an expression of type 'double). Any idea what I'm doing wrong, based on the code below?

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// Test1
    /// </summary>
    [Description("Test1")]
    public class Test1 : Strategy
    {
    #region Variables
    // Wizard generated variables
    private int myInput0 = 1; // Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    #endregion

    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    {

    CalculateOnBarClose = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Condition set 1
    if (FisherTransform(10)[0] > 2.5)
    {
    DrawDiamond("My diamond" + CurrentBar, false, 0, High[0] + 1 * TickSize, Color.Red);
    }
    }

    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public int MyInput0
    {
    get { return myInput0; }
    set { myInput0 = Math.Max(1, value); }
    }
    #endregion
    }

    #2
    EzCohen, the script you posted looks ok - are you sure the issue is found in this very script? Please doubleclick on the compile error at notice at the bottom of the editor and the it would take you directly to the offending code line even if in another script.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X