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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X