Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Where is the problem

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

    Where is the problem

    You will find hereunder the core of an indicator which plots correctly as long as I don't use oscib[0] (oscil[0]/SMA(test,252)[0] is OK) but does not plot anything with the complete code. Does anyone can tell me what is wrong and how to solve this problem?

    protectedoverridevoid Initialize()
    {
    Add(
    new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "Oscillateur"));
    CalculateOnBarClose =
    false;
    Overlay =
    false;
    PriceTypeSupported =
    true;
    test=
    new DataSeries(this);
    oscil=
    new DataSeries(this);
    oscib=
    new DataSeries(this);
    }
    ///<summary>
    /// Called on each bar update event (incoming tick)
    ///</summary>
    protectedoverridevoid OnBarUpdate()
    {

    test.Set(
    100*Math.Abs((SMA(fast)[0]-SMA(slow)[0]))/Close[0]);
    oscil.Set(
    100*(SMA(fast)[0]-SMA(slow)[0])/Close[0]);
    oscib.Set(
    100*(SMA(fast)[1]-SMA(slow)[1])/Close[1]);
    Value.Set((oscil[
    0]-oscib[0])/SMA(test,252)[0]);

    }

    #2
    You're try to access a dataseries object that is not present at the start of the chart, see this tip here -

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks a lot for this fast answer

      Code is now running correctly

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by HappyTrader76, 06-11-2024, 03:29 AM
      9 responses
      45 views
      0 likes
      Last Post HappyTrader76  
      Started by Stanfillirenfro, Today, 05:35 AM
      0 responses
      3 views
      0 likes
      Last Post Stanfillirenfro  
      Started by Taddypole, Yesterday, 12:56 PM
      2 responses
      9 views
      0 likes
      Last Post Taddypole  
      Started by iq200, Today, 04:26 AM
      0 responses
      4 views
      0 likes
      Last Post iq200
      by iq200
       
      Started by Uregon, Today, 03:50 AM
      0 responses
      6 views
      0 likes
      Last Post Uregon
      by Uregon
       
      Working...
      X