Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mutli Time Frame using DataSeries

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

    Mutli Time Frame using DataSeries

    Edit: This is for NT7. Sorry.

    I have attempted to turn the TRIX indicator into a MTF using DataSeries. I put the TRIX on an ES 7500 Volume Chart. Then I put the following code on the ES 2500 Volume chart. The OutputWindow from this code does not match the Data Window from the 7500 Chart. The Bar time stamps and the Inputs[0] do match but the indicator values do not. Can you tell me where this thing went off the rails. Help would be much appreciated because I am lost. Probably something super simple and I will be wearing a dunce cap.

    #region Variables
    private int period = 14;
    private int signalPeriod = 3;

    private DataSeries Default;
    private DataSeries Signal;

    private PeriodType chartType = PeriodType.Volume;
    private int chartInterval = 7500;
    #endregion

    /// <summary>
    /// This method is used to configure the indicator and is called once before any bar data is loaded.
    /// </summary>
    protected override void Initialize()
    {
    Overlay = true;

    // Add Secondary Chart. Bars Array 1
    Add(ChartType, ChartInterval);
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    // Sync Secondary DataSeries
    if (Default == null)
    {
    Default = new DataSeries(SMA(BarsArray[1], 2));
    Signal = new DataSeries(SMA(BarsArray[1], 2));
    }
    if (BarsInProgress == 1)
    {
    if (CurrentBar == 0)
    {
    Value.Set(Input[0]);
    return;
    }
    EMA tripleEma = EMA(EMA(EMA(Inputs[0], Period), Period), Period);
    double trix = 100 * ((tripleEma[0] - tripleEma[1]) / tripleEma[0]);

    Default.Set(trix);
    Signal.Set(EMA(Default, SignalPeriod)[0]);
    Print(String.Format("{0,20} Inputs[0] {1,7:0000.00} Default {2:0.0000000} Signal {3:0.0000000}",
    Time[0], Inputs[0], Default[0], Signal[0]));
    }
    }

    #region Properties
    [Description("Numbers of bars used for calculations.")]
    [GridCategory("Parameters")]
    public int Period
    {
    get { return period; }
    set { period = Math.Max(1, value); }
    }

    [Description("Period for the signal line.")]
    [GridCategory("Parameters")]
    [Gui.Design.DisplayNameAttribute("Signal period")]
    public int SignalPeriod
    {
    get { return signalPeriod; }
    set { signalPeriod = Math.Max(1, value); }
    }


    [Description("")]
    [GridCategory("Parameters")]
    [Gui.Design.DisplayNameAttribute("Chart Type")]
    public PeriodType ChartType
    {
    get { return chartType; }
    set { chartType = value; }
    }

    [Description("")]
    [GridCategory("Parameters")]
    [Gui.Design.DisplayNameAttribute("Bar Period")]
    public int ChartInterval
    {
    get { return chartInterval; }
    set { chartInterval = Math.Max(1, value); }
    }
    #endregion

Latest Posts

Collapse

Topics Statistics Last Post
Started by Hwop38, 05-04-2026, 07:02 PM
0 responses
164 views
0 likes
Last Post Hwop38
by Hwop38
 
Started by CaptainJack, 04-24-2026, 11:07 PM
0 responses
318 views
0 likes
Last Post CaptainJack  
Started by Mindset, 04-21-2026, 06:46 AM
0 responses
246 views
0 likes
Last Post Mindset
by Mindset
 
Started by M4ndoo, 04-20-2026, 05:21 PM
0 responses
350 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Started by M4ndoo, 04-19-2026, 05:54 PM
0 responses
179 views
0 likes
Last Post M4ndoo
by M4ndoo
 
Working...
X