• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi Time frame reflection decalred indicators not working in Strategy

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

    Multi Time frame reflection decalred indicators not working in Strategy

    Hello Forum,

    I'm building a strategy that uses three timeframes. It runs in the 60 minute timeframe (BarsArray[0]) and uses 1 day (BarsArray[1]) and 1 minute (BarsArray[2]) for entries and exits.

    Here what's happening. I've reflected a couple of indicators Bollinger, SMA, VOL and VOLMA. Some are reflected and all put on the Strategies chart with AddChartIndicator().

    I saw some results that didn't make sense and when I investigated I found that the Bollinger I reflected was using the 60 minute time frame inspite of my explicit declaration to use the daily (BarsArray[1]).

    Here's the code:
    else if (State == State.Configure)
    {
    AddDataSeries(BarsPeriodType.Day,1); // BarsArray[1]
    AddDataSeries(BarsPeriodType.Minute,1); // BarsArray[2]

    StratVOLMA = VOLMA(BarsArray[1], VOLMAPeriod1);
    StratVOLMA.Panel = 2;
    VOL(BarsArray[1]).Panel = 2;
    AddChartIndicator(VOL(BarsArray[1]));
    AddChartIndicator(StratVOLMA);

    StratSMA50 = SMA(BarsArray[1], SMAPeriod2);
    StratSMA50.Plots[0].Brush = Brushes.Magenta;
    AddChartIndicator(StratSMA50);

    StratBB = Bollinger(BarsArray[1], BBStdDev, BBPeriod);
    AddChartIndicator(Bollinger(BarsArray[1], BBStdDev, BBPeriod));
    ClearOutputWindow();
    }

    Even when adding the Bollinger to chart with a specific declaration (and not the reflected StratBB), the chart says I added it with the 60 minute timeframe.
    http://prntscr.com/ceh6ca

    This isn't just showing me the 60 minute on the chart , the value of the reflected variable also corresponds to the 60 minute timeframe.

    If I explicitly declare the indicator each time I'm checking values (Bollinger(BarsArray[1], BBStdDev, BBPeriod).Upper[0]) it works as expected.

    Not a big deal for indicators with few variables, but reflection is critical for me using some custom indicators with lots of variables.

    Let me know if you more info to duplicate this.
    Last edited by daqu40; 09-05-2016, 12:58 PM.
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    Hello daqu40,

    Thank you for your post.

    The StratBB should reflect the correct values. However you cannot add a chart indicator using a secondary series that you add in the code that is calling AddChartIndicator.

    You would need to have the indicator you are calling add the secondary series to it's code as well and use it for it's values.

    Development is tracking requests for being able to add chart indicators using adding bar series in the same code under SFT-1576.
    Patrick H.NinjaTrader Customer Service

    Comment


      #3
      The chart indicator I can understand.

      How about if I reflect an indicator with a different BarsArray that I use internally to the strategy and don't put on the chart. Is this expected to work?
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment


        #4
        Hello daqu40,

        Thank you for your response.

        Yes, you can use the BarsArray for the indicator in this manner. You would need to ensure that the DataLoaded State has processed. For example:
        In OnStateChange():
        Code:
        			else if (State == State.Configure)
        			{
        				AddDataSeries(BarsPeriodType.Minute, 5);
        				
        			}
        			else if (State == State.DataLoaded)
        			{
        				mySMA = SMA(BarsArray[1], 1);
        			}
        Patrick H.NinjaTrader Customer Service

        Comment


          #5
          Thanks, I'll try that.
          daqu40
          NinjaTrader Ecosystem Vendor - QTradez

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by yikccv, Today, 08:49 PM
          0 responses
          2 views
          0 likes
          Last Post yikccv
          by yikccv
           
          Started by supernova0219, Today, 07:48 PM
          0 responses
          5 views
          0 likes
          Last Post supernova0219  
          Started by qwfxny, Today, 07:20 PM
          0 responses
          3 views
          0 likes
          Last Post qwfxny
          by qwfxny
           
          Started by bouncetherubble, Today, 04:48 PM
          0 responses
          3 views
          0 likes
          Last Post bouncetherubble  
          Started by johnnybegoode, Today, 11:35 AM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X