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 ultzjudithsch, Today, 04:03 AM
      0 responses
      2 views
      0 likes
      Last Post ultzjudithsch  
      Started by Christopher Leggit, Today, 03:57 AM
      0 responses
      7 views
      0 likes
      Last Post Christopher Leggit  
      Started by sweetreliefglycogen, Today, 03:26 AM
      0 responses
      5 views
      0 likes
      Last Post sweetreliefglycogen  
      Started by Atlant, 05-03-2024, 09:23 AM
      3 responses
      49 views
      0 likes
      Last Post Atlant
      by Atlant
       
      Started by Board game geek, 10-29-2023, 12:00 PM
      16 responses
      329 views
      0 likes
      Last Post Gibranes  
      Working...
      X