• 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

When is Time[0] active

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

    When is Time[0] active

    I have some logic in indicator and was wondering when Time[0] becomes the the current bar on the chart. When i did a printout it was the very first bar on the chart.

    I have this statement

    if (Time[0] > drawList[nIndex].Time)
    {

    I use this function only at startup

    i used this
    if (CurrentBar == 2)
    {
    }

    and it doesn't work;


    if I keep it out it will work but because of the loop logic it will take a while to load.

    How do you get around this issue?

    #2
    Hello ballboy11,

    Thank you for writing in.

    Every bar draw on a chart will have been at a time, Time[0]. For example, when a chart is drawn, the bars are drawn on the chart from left to right, and on each bar being drawn, it is the current bar.

    If you wanted to prevent the issue where old historical bars are Time[0], you could add the following to the top of your code,k
    Code:
    if(State ==State.Historical) return;
    The above will cause the script to only run in real time.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by fredfred, Today, 03:41 AM
    2 responses
    8 views
    0 likes
    Last Post fredfred  
    Started by TraderYoda, Today, 03:33 AM
    0 responses
    1 view
    0 likes
    Last Post TraderYoda  
    Started by pjsmith, Today, 02:56 AM
    0 responses
    3 views
    0 likes
    Last Post pjsmith
    by pjsmith
     
    Started by ntbone, Yesterday, 08:10 PM
    0 responses
    11 views
    0 likes
    Last Post ntbone
    by ntbone
     
    Started by chrislou, 08-28-2015, 03:27 AM
    14 responses
    2,883 views
    0 likes
    Last Post nkhoi
    by nkhoi
     
    Working...
    X