Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multiple timeframe indiwator always 0

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

    multiple timeframe indiwator always 0

    My test indicator is successfully plot on chart but when inserted in market analyzer the column is always at 0.

    The historical quotes is about 4 years long and I have tried different look back combinaison: 50,100,400.

    WHen deleting Add(PeriodType.Week,1); and plotting directly upper band the indication is OK in column's analyzer.

    setectT1.Set(lowerValue);

    Plot0.Set(detectT1[0]); //OK

    Any idea please. Thanks
    Attached Files

    #2
    Hello altias,

    One issue is you're assigning your T1Cond value conditionally, but also for every OnBarUpdate() call.

    int T1Cond=0;

    You want to declare this initially in the Variables region, and it is available for the whole script without reassigning the value unintentionally.

    private int T1Cond;


    You don't have all the code logic connected in the lines below. The plot set doesn't belong as part of the else branch unless you add curly brackets around all the statements you want executed.

    else
    {
    detectT1.Set(lowerValue);
    Plot0.Set(detectT1[0]);
    }
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks for this quick response.

      1- since the scope of T1cond is local to OnBarUpdate() method I think i do not need to declare as field

      2- the if/else is just for demonstration purpose: si SMA is Up then upperband is plotted else lower band =>So Plot0.Set does not need to be in if/else statement

      if (UpMM7Week==1)
      detectT1.Set(upperValue);
      else
      detectT1.Set(lowerValue);

      Plot0.Set(detectT1[0]); // NOT in if /else

      3- I have made a simplier indicator wirh the same symptoma (0 value in analyzer column)
      protectedoverridevoid OnBarUpdate()
      {
      // Checks to ensure all Bars objects contain enough bars before beginning
      if (CurrentBars[0] < 100 || CurrentBars[1] < 100)
      {
      detectT1.Set(
      10);
      Plot0.Set(detectT1[
      0]);
      return;
      }

      double upperValue = Bollinger(Typicals[0],2, 20).Upper[0];
      double lowerValue = Bollinger(Typicals[0],2, 20).Lower[0];

      Plot0.Set(upperValue);

      }

      Any idea please?

      Comment


        #4
        I see - - Thanks for the reply. I would take a look at available bars, and maybe that first block that sets whenever CurrentBar < 100.

        Print(CurrentBar); value to see where you are at by the time the indicator gets to real time processing.

        Market analyzer doesn't have available a "days back" setting like on chart. It's all done by bars and you may not have enough. Check this through the right click > properties screen.
        Ryan M.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by junkone, Today, 11:37 AM
        0 responses
        2 views
        0 likes
        Last Post junkone
        by junkone
         
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        34 views
        0 likes
        Last Post love2code2trade  
        Started by cls71, Today, 04:45 AM
        2 responses
        10 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Working...
        X