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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    59 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X