Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Bar Brush indicator issue

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

  • Impeesa
    replied
    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

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    Hello Impeesa,

    Thanks for your reply.

    Do you mean the currently forming bar is not colored when/as it hits the limit?

    Leave a comment:


  • Impeesa
    replied
    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

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    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);
    }
    }

    Leave a comment:


  • Impeesa
    replied
    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;
    }

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    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.

    Leave a comment:


  • Impeesa
    replied
    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

    Leave a comment:


  • NinjaTrader_PaulH
    replied
    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?

    Leave a comment:


  • Impeesa
    started a topic Bar Brush indicator issue

    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by Stanfillirenfro, Today, 07:23 AM
4 responses
19 views
0 likes
Last Post Stanfillirenfro  
Started by DayTradingDEMON, Today, 09:28 AM
1 response
13 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by cmtjoancolmenero, Yesterday, 03:58 PM
8 responses
31 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by helpwanted, Today, 03:06 AM
2 responses
22 views
0 likes
Last Post NinjaTrader_LuisH  
Started by navyguy06, Today, 09:28 AM
0 responses
6 views
0 likes
Last Post navyguy06  
Working...
X