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

Help : Indicator does not display

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

    Help : Indicator does not display

    My indicator does not plot anything.
    I have checked the log file and got the following message error :
    "Error on plotting indicator "xx": please check the OnBarUpdate() method or the Plot() method : out of bound issue"

    Tried to find where it comes from without success

    Here is the code :

    #region Variables
    // Wizard generated variables
    privateint period = 10; // Default setting for Period
    // User defined variables (add any user defined variables below)
    private DataSeries Value1;
    privatedouble MyVal =0.0;
    private DataSeries Value2;
    private DataSeries Value3;
    #endregion

    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    CalculateOnBarClose =
    true;
    Overlay =
    false;
    PriceTypeSupported =
    false;
    Value1=
    new DataSeries(this);
    Value2=
    new DataSeries(this);
    Value3=
    new DataSeries(this);
    }

    protectedoverridevoid OnBarUpdate()
    {


    if (CurrentBar >= 40)
    {
    Value1.Set(TEMA(Input,period)[
    0]);
    Value3.Set(Math.Log(Value1[
    0]));

    for (int n = 1; n<41 ; n++)
    {
    MyVal=MyVal+LinRegSlopeSFX(Value3,
    false,n,0)[0]*Math.Sqrt(n);
    }
    }
    Value2.Set(MyVal*
    100);
    MyVal=
    0;
    Plot0.Set(Value2[
    0]);
    }




    #2
    Originally posted by kuroro13 View Post
    My indicator does not plot anything.
    I have checked the log file and got the following message error :
    "Error on plotting indicator "xx": please check the OnBarUpdate() method or the Plot() method : out of bound issue"

    Tried to find where it comes from without success

    Here is the code :

    #region Variables
    // Wizard generated variables
    privateint period = 10; // Default setting for Period
    // User defined variables (add any user defined variables below)
    private DataSeries Value1;
    privatedouble MyVal =0.0;
    private DataSeries Value2;
    private DataSeries Value3;
    #endregion

    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    CalculateOnBarClose =
    true;
    Overlay =
    false;
    PriceTypeSupported =
    false;
    Value1=
    new DataSeries(this);
    Value2=
    new DataSeries(this);
    Value3=
    new DataSeries(this);
    }

    protectedoverridevoid OnBarUpdate()
    {


    if (CurrentBar >= 40)
    {
    Value1.Set(TEMA(Input,period)[
    0]);
    Value3.Set(Math.Log(Value1[
    0]));

    for (int n = 1; n<41 ; n++)
    {
    MyVal=MyVal+LinRegSlopeSFX(Value3,
    false,n,0)[0]*Math.Sqrt(n);
    }
    }
    Value2.Set(MyVal*
    100);
    MyVal=
    0;
    Plot0.Set(Value2[
    0]);
    }




    Value3.Set(Math.Log(Value1[0]));

    You might want to check Value1[0] for zero value

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by zstheorist, Today, 07:52 PM
    0 responses
    3 views
    0 likes
    Last Post zstheorist  
    Started by pmachiraju, 11-01-2023, 04:46 AM
    8 responses
    149 views
    0 likes
    Last Post rehmans
    by rehmans
     
    Started by mattbsea, Today, 05:44 PM
    0 responses
    5 views
    0 likes
    Last Post mattbsea  
    Started by RideMe, 04-07-2024, 04:54 PM
    6 responses
    33 views
    0 likes
    Last Post RideMe
    by RideMe
     
    Started by tkaboris, Today, 05:13 PM
    0 responses
    5 views
    0 likes
    Last Post tkaboris  
    Working...
    X