Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnBarClose problem

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

    OnBarClose problem

    Hello,

    I stuck with this problem: I cannot make to work OnBarClose indicators correctly with per tick strategy.

    I have real time strategy with CalculateOnBarClose set to false. However I use indicators that produce safe values only at the end of the bar. So I have FirstTick condition and feed these aquired values to Indicators via DataSeries array like shown below:

    protected override void OnBarUpdate()
    {
    if (FirstTickOfBar) {
    indicatorData.Set(Input[1]);
    getValue = MyIndicator( indicatorData, someMax, someMin );
    }
    // etc.
    }

    Also I have added these indicators to Initialize() constructor of my strategy like this:

    indicatorData = new DataSeries(this);
    if (drawValues) {
    Add(MyIndicator( indicatorData, someMax, someMin ));
    }

    indicatorData is private DataSeries indicatorData;

    To my amazement this plot is completely out of sync with data (zero values) for about 240 bars and there is no logic that controls when to start plot values or smth. If I remove indicatorData array from parameters to my Indicator - I get real time plot, that changes values on real time. And while it is fun to watch live plot, it triggers setups that are no longer valid after next bar. My solution to feed OnBarClose input values in array seemed like elegant solution but it doesn't seem to work. Am I missing something?

    Thank you very much,
    -A.

    #2
    Hello A,

    It seems like you are working along this sample here:


    Are there any error messages noted in log tab of the control center?

    It may work best to work from a simplified example and then add complexity only when you've verified everything works the way you expect. The link above offers one sample implementation you can work from.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X