Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Brush indicator issue

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

    Bar Brush indicator issue

    I have created several indicators "Calculate.OnEachTick". In order to get different signals, one of them uses Draw.Text and runs ok.

    The other one uses BarBrush and CandleOutlineBrush. In this case, it only works in the workspace active and in a tab active, while others indicators run in a second workspace opened and also in two or more tabs of a chart.

    Any idea how can I manage this issue?

    Thanks

    #2
    Hello Impeesa,

    Thanks for your post.

    I've read your post a couple of times and I'm sorry but it is not clear what the "Bar Brush indicator issue" is that you are reporting.

    Can you clarify further what specifically is or is not happening that you are determining is an issue?

    Are you saying that when you switch workspaces the indicators no longer indicate?

    Do you have any related error messages in the "Log" tab of the control center?

    Are you working with live data or playback with market replay data?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello, Paul

      I am working with live data. My indicator uses BarBrush and CandleOutlineBrush when conditions are met and works fine. When I switch to another workspace and turn back later no bars are coloured despite that the worspace remains opened.

      The same issue happens when in a window whers my indicator is running ok. I switch to another tab and when I turn back later no bars are coloured neither...

      "Are you saying that when you switch workspaces the indicators no longer indicate?"

      No, while I am in another workspace it does not indicate and, when I turn back, it indicate from the current bar.

      Thanks for your attention

      Comment


        #4
        Hello Impeesa,

        Thanks for your reply and clarification.

        Do you see any error messages in the "Log" tab of the control center that would relate?

        If no error messages, please post the code sections you are using to color the barbrush and the outline.

        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello, Paul

          There are no error messages. Here is the code

          else if (State == State.Configure)
          {
          AddDataSeries(Data.BarsPeriodType.Tick, 1);
          }
          else if (State == State.DataLoaded)
          {
          // Instantiate the indicator
          cumulativeDelta = OrderFlowCumulativeDelta(CumulativeDeltaType.BidAs k, CumulativeDeltaPeriod.Bar, 0);
          }
          }

          protected override void OnBarUpdate()
          {
          if (BarsInProgress != 0)
          return;

          if (CurrentBars[0] < 1
          || CurrentBars[1] < 0)
          return;

          else if (BarsInProgress == 1)
          {
          // We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync
          cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
          }

          if (cumulativeDelta.DeltaHigh[0] > Limit)
          {
          BarBrush = Brushes.Fuchsia;
          CandleOutlineBrush = Brushes.Fuchsia;
          }

          Comment


            #6
            Hello Impeesa,

            Thanks for your reply.

            Rearrange the code to look like this:

            protected override void OnBarUpdate()
            {
            if (CurrentBars[0] < 1 || CurrentBars[1] < 0)
            return;

            if (BarsInProgress == 0) // only color the bars when the chart bars call the OnBarUpdate.
            {
            if (cumulativeDelta.DeltaHigh[0] > Limit)
            {
            BarBrush = Brushes.Fuchsia;
            CandleOutlineBrush = Brushes.Fuchsia;
            }
            }
            else if (BarsInProgress == 1) // update the cumulative delta indicator
            {
            // We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync
            cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
            }
            }

            Paul H.NinjaTrader Customer Service

            Comment


              #7
              Hello Paul

              I have made the changes you suggested and now, when I switch to another workspace and then I turn back later bars are coloured but with a delay of one.

              Is ther any other option to fix that issue?

              Thanks a lot

              Comment


                #8
                Hello Impeesa,

                Thanks for your reply.

                Do you mean the currently forming bar is not colored when/as it hits the limit?
                Paul H.NinjaTrader Customer Service

                Comment


                  #9
                  Hello, Paul

                  Sorry, I was wrong. Now when I turn back to the workspace where the indicator is running, the bar coloured is the previous where the condition met...
                  Attached Files

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by soon123, Today, 02:14 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post soon123
                  by soon123
                   
                  Started by guilhem, Today, 01:53 AM
                  1 response
                  6 views
                  0 likes
                  Last Post sgkcfc
                  by sgkcfc
                   
                  Started by elkingonzalez, 11-24-2020, 09:59 AM
                  4 responses
                  40 views
                  0 likes
                  Last Post MrSmart
                  by MrSmart
                   
                  Started by Photon66, Today, 12:03 AM
                  0 responses
                  9 views
                  0 likes
                  Last Post Photon66  
                  Started by morrnel, Yesterday, 09:38 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_Marco  
                  Working...
                  X