• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Last Historical Bar?

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

  • FREEN
    started a topic Last Historical Bar?

    Last Historical Bar?

    Any suggestion on how to trigger OnBarUpdate on last historical bar only?

    Bars.LastHistorical or Bars.Loaded properties would be handy properties for this purpose.

    The indicator I´m working with uses Infinite lookback and performs all historical calculations (0 -> CurrentBar looping) on each bar - hence last historical/current bar update only would make loading faster.

    Kindly, Fredrik
    Last edited by FREEN; 11-09-2011, 04:25 AM.

  • ninZa
    replied
    I see. Your answer was tied to the scenario in the asked question.

    By the way, what is the meaning of Osikani? Can you explain it to all the people here.

    Thank you Koganam.

    Leave a comment:


  • koganam
    replied
    Originally posted by ninZa View Post
    Please check it Koganam.

    Yesterday I played with both of them. Changing COBC to false increased the value of LastBarIndexPainted by 1 (for the actual last bar on chart). So LastBarIndexPainted is dependent on COBC.

    Just from the logic, we can also tell that a thing related to ChartControl (ChartControl.LastBarPainted) cannot be dependent on COBC.
    Granted the truth of what you are saying if the CurrentBar is the last bar being displayed on the chart, I was answering the thrust of the original question, which wanted to know the index of the "last bar showing on the right" if the chart was somewhere in the middle. Given that, I did not go into the niceties of what happens in the edge state, as that is not what the original question was about.

    This question: http://www.ninjatrader.com/support/f...90&postcount=6

    Put the display into "threaded" mode, and you will see that that is the question to which I was responding.
    Last edited by koganam; 02-04-2015, 09:44 PM.

    Leave a comment:


  • ninZa
    replied
    Originally posted by koganam View Post
    Could be, but I am pretty sure that what I wrote is correct.
    Please check it Koganam.

    Yesterday I played with both of them. Changing COBC to false increased the value of LastBarIndexPainted by 1 (for the actual last bar on chart). So LastBarIndexPainted is dependent on COBC.

    Just from the logic, we can also tell that a thing related to ChartControl (ChartControl.LastBarPainted) cannot be dependent on COBC.

    Leave a comment:


  • koganam
    replied
    Originally posted by ninZa View Post
    My skill is googling Koganam lol.

    Regarding your comment about the dependence on COBC, should we reverse the order? I mean the 1st one (ChartControl) should be absolute, and the 2nd one is dependent on COBC?
    Could be, but I am pretty sure that what I wrote is correct.

    Leave a comment:


  • ninZa
    replied
    Originally posted by koganam View Post
    Probably from here: http://www.ninjatrader.com/support/f...d.php?p=261631

    Though, given his skills, Ninza may have come upon that independently.
    My skill is googling Koganam lol.

    Regarding your comment about the dependence on COBC, should we reverse the order? I mean the 1st one (ChartControl) should be absolute, and the 2nd one is dependent on COBC?
    Last edited by ninZa; 02-04-2015, 06:21 PM.

    Leave a comment:


  • koganam
    replied
    Originally posted by marty087 View Post
    BOOM! Worked a charm. Where did you pull that one from?

    Thanks.
    Probably from here: http://www.ninjatrader.com/support/f...d.php?p=261631

    Though, given his skills, Ninza may have come upon that independently.

    Leave a comment:


  • marty087
    replied
    Originally posted by ninZa View Post
    It works actually? I'm not sure, so I gave you another solution above.

    I don't remember where I got the info of LastBarIndexPainted. Perhaps searched something on Google and found it.

    Regards.
    Pi
    Great stuff. Thanks again

    Leave a comment:


  • ninZa
    replied
    Originally posted by marty087 View Post
    BOOM! Worked a charm. Where did you pull that one from?

    Thanks.
    It works actually? I'm not sure, so I gave you another solution above.

    I don't remember where I got the info of LastBarIndexPainted. Perhaps searched something on Google and found it.

    Regards.
    Pi

    Leave a comment:


  • marty087
    replied
    Originally posted by ninZa View Post
    marty087, please try LastBarIndexPainted. I'm not sure this works in your case. This will give you the last bar painted on chart after the bars are loaded. In your case, you want to get the value in advance, so I'm not sure. Please test it, if it doesn't work, we will have to take another approach.

    Thanks.
    BOOM! Worked a charm. Where did you pull that one from?

    Thanks.
    Attached Files

    Leave a comment:


  • ninZa
    replied
    Originally posted by marty087 View Post
    In short....

    CurrentBar returns the id of the last bar displyed on the right of the screen irrecpective of whether the chart is scrolled to the end or not.

    Count OR Bars.Count returns how many bars are in the chart once fully loaded / scrolled to the right alll the way

    So..... if i am in the middle of the chart and want my indicator to only execute once it has arrived at the furtherest scrooled bar, is there any way to do this?

    FREEN, is it fair to say that the supplied code below (Bertrand's contribution) didnt provide a solution for you?

    Cheers Guys.
    marty087, when you are in the middle of the chart, the indicator will only execute until the last bar printed on your chart and then it will temporarily stop there, until a LIVE tick comes in. If there are no live data coming in, the indicator will not reach the actual last bar (whose index is Bars.Count - 1). You have to manually scroll your chart back to the actual last bar. This is my 30-minute inspection on the issue, need a confirmation from NT staff.

    However, if in a live market with fast coming data, you can execute the following unsupported codes to ignore all bars until the last painted bar:


    if (ChartControl.GetXByBarIdx(BarsArray[0], CurrentBar) < ChartControl.CanvasRight) return;
    Cheers.
    Pi
    Last edited by ninZa; 02-04-2015, 03:08 AM.

    Leave a comment:


  • ninZa
    replied
    marty087, please try LastBarIndexPainted. I'm not sure this works in your case. This will give you the last bar painted on chart after the bars are loaded. In your case, you want to get the value in advance, so I'm not sure. Please test it, if it doesn't work, we will have to take another approach.

    Thanks.
    Last edited by ninZa; 02-04-2015, 02:22 AM.

    Leave a comment:


  • marty087
    replied
    In short....

    CurrentBar returns the id of the last bar displyed on the right of the screen irrecpective of whether the chart is scrolled to the end or not.

    Count OR Bars.Count returns how many bars are in the chart once fully loaded / scrolled to the right alll the way

    So..... if i am in the middle of the chart and want my indicator to only execute once it has arrived at the furtherest scrooled bar, is there any way to do this?

    FREEN, is it fair to say that the supplied code below (Bertrand's contribution) didnt provide a solution for you?

    Cheers Guys.

    Leave a comment:


  • marty087
    replied
    Originally posted by ninZa View Post
    Can you clarify the meaning of "scroll point"? A screenshot with your notes on it will easily explain.
    See pic for clarification
    Attached Files

    Leave a comment:


  • FREEN
    replied
    Originally posted by ninZa View Post
    Can you clarify the meaning of "scroll point"? A screenshot with your notes on it will easily explain.
    Scroll point in the sense last bar on screen, that might not be bars.count.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Davoone1, Today, 07:28 PM
0 responses
3 views
0 likes
Last Post Davoone1  
Started by quantera, Today, 05:38 PM
0 responses
5 views
0 likes
Last Post quantera  
Started by ciro1963, Today, 03:58 PM
0 responses
3 views
0 likes
Last Post ciro1963  
Started by swcooke, Today, 02:48 PM
1 response
6 views
0 likes
Last Post NinjaTrader_Jesse  
Started by SOFI777, Today, 01:03 PM
5 responses
31 views
0 likes
Last Post SOFI777
by SOFI777
 
Working...
X