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 -

    http://www.ninjatrader-support2.com/...ead.php?t=3170
    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 smk200, Today, 10:29 AM
      0 responses
      8 views
      0 likes
      Last Post smk200
      by smk200
       
      Started by Austiner87, Today, 09:44 AM
      2 responses
      17 views
      0 likes
      Last Post Austiner87  
      Started by TriGuy818, Today, 09:19 AM
      2 responses
      14 views
      0 likes
      Last Post TriGuy818  
      Started by 7robert, Today, 09:12 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Kate  
      Started by space_trader, Today, 09:11 AM
      2 responses
      25 views
      0 likes
      Last Post space_trader  
      Working...
      X