Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rhyminkevin, Today, 04:58 PM
    3 responses
    47 views
    0 likes
    Last Post Anfedport  
    Started by iceman2018, Today, 05:07 PM
    0 responses
    5 views
    0 likes
    Last Post iceman2018  
    Started by lightsun47, Today, 03:51 PM
    0 responses
    7 views
    0 likes
    Last Post lightsun47  
    Started by 00nevest, Today, 02:27 PM
    1 response
    14 views
    0 likes
    Last Post 00nevest  
    Started by futtrader, 04-21-2024, 01:50 AM
    4 responses
    50 views
    0 likes
    Last Post futtrader  
    Working...
    X