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

Last Historical Bar?

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

  • 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:


  • sledge
    replied
    Originally posted by marty087 View Post
    HI Guys,

    I would like to do exactly what Freen has requested here.
    Then you are not doing exactly what Freen is doing.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by yertle, Yesterday, 08:38 AM
7 responses
28 views
0 likes
Last Post yertle
by yertle
 
Started by bmartz, 03-12-2024, 06:12 AM
2 responses
20 views
0 likes
Last Post bmartz
by bmartz
 
Started by funk10101, Today, 12:02 AM
0 responses
4 views
0 likes
Last Post funk10101  
Started by gravdigaz6, Yesterday, 11:40 PM
1 response
8 views
0 likes
Last Post NinjaTrader_Manfred  
Started by MarianApalaghiei, Yesterday, 10:49 PM
3 responses
10 views
0 likes
Last Post NinjaTrader_Manfred  
Working...
X