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 terofs, Yesterday, 04:18 PM
    1 response
    21 views
    0 likes
    Last Post terofs
    by terofs
     
    Started by CommonWhale, Today, 09:55 AM
    1 response
    3 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by Gerik, Today, 09:40 AM
    2 responses
    7 views
    0 likes
    Last Post Gerik
    by Gerik
     
    Started by RookieTrader, Today, 09:37 AM
    2 responses
    12 views
    0 likes
    Last Post RookieTrader  
    Started by alifarahani, Today, 09:40 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X