Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarsArray issue

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

    BarsArray issue

    Hello,
    I'm working on a multi-time frame indicator. I'd like to have an indicator taking data from say a 12 range print on a 4 range. I worked it out with a SMA, but when I try to apply the same rules to this SuperTrend indicator I get nothing. Here is my code:
    Code:
    {
            #region Variables
                private DataSeries UpTrend;
            #endregion
            protected override void Initialize()
            {
               Add(new Plot(Color.FromKnownColor(KnownColor.Purple), PlotStyle.Line, "SMALine"));
                Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "UpTrend"));
                Overlay                = true;
                Plots[0].Pen.Width = 4;
                Plots[0].Pen.Width = 4;
                Add(PeriodType.Range, 12);
                Add(PeriodType.Range, 12);
                UpTrend = new DataSeries(this);
            }
            protected override void OnBarUpdate()
            {
                if (CurrentBars[0] < BarsRequired || CurrentBars[1] < BarsRequired || CurrentBars[2] < BarsRequired )
                return;
                
                SMALine.Set (SMA(BarsArray[1], 14)[0]) ;
                UpTrend.Set (SuperTrend(BarsArray[2],14, 2.618, true).UpTrend[0]) ;
            }
    Can anyone offer some help? Thank you.
    Attached Files
    Last edited by CaptainAmericaXX; 01-04-2013, 07:35 PM.

    #2
    Ok, I figured out the problem with the 2nd indicator. The public DataSeries in the Properties was labeled incorrectly. Now if someone could show me how to turn off the Uptrend line in the SuperTrend indicator when the Downtrend line is taking over I'd be forever grateful!
    Here is the SuperTrend .zip.
    Attached Files
    Last edited by CaptainAmericaXX; 01-04-2013, 08:17 PM.

    Comment


      #3
      Originally posted by CaptainAmericaXX View Post
      Ok, I figured out the problem with the 2nd indicator. The public DataSeries in the Properties was labeled incorrectly. Now if someone could show me how to turn off the Uptrend line in the SuperTrend indicator when the Downtrend line is taking over I'd be forever grateful!
      Here is the SuperTrend .zip.
      Where in the code do we see when one line is taking over from the other?

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WaveAtElliot, Today, 05:11 PM
      1 response
      9 views
      1 like
      Last Post hdge4u
      by hdge4u
       
      Started by bosajin, Yesterday, 09:15 AM
      5 responses
      36 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by Dolfan, Today, 12:24 PM
      4 responses
      23 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by WeyldFalcon, Today, 11:09 AM
      7 responses
      26 views
      0 likes
      Last Post WeyldFalcon  
      Started by DTSSTS, 08-10-2020, 09:48 AM
      12 responses
      67 views
      0 likes
      Last Post DTSSTS
      by DTSSTS
       
      Working...
      X