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

Track a specific Bar

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

    Track a specific Bar

    Hi I am writing a indicator that looks for a specific bar type (an inverted Hammer, I call this bar a signal bar) based on a series of 3 bars occurring.

    I can determine when my signal Bar occurs, but what I then want to do is, wait for another 4 bars to occur then for every bar at bar 5 or greater from the signal bar, check to see if the current bar is above the high of the previous bar.

    So my question is once I have determined the presence of a signal bar how do I track it so I can determine how far advanced I am from that point. Currently I am thinking a variable that holds the signal bar's Time reference 'Time[0]' could be the way to go, but I am not sure how to check a currentBars time reference against a variable holding a time reference.

    Possibly:

    currentBarTime.Set(Time[0])

    If (currentBarTime < (signalBarTime + 50000) {do something}

    as time is in milliseconds and I am considering bars on an 1hour chart time will have to be X times 10,000

    Thoughts?

    Kind regards

    Duncan

    #2
    Ok I answered my own question.

    The answer is to track a bar's time indicator, and then use an if statement

    if (Time[0].Hour > (signalBarTime[0].Hour + 3))

    I discovered through trial and error hours are whole numbers and not in milliseconds as I first thought.

    Anyway I hope this question helps others

    Kind regards

    Duncan

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by quantismo, 04-17-2024, 05:13 PM
    5 responses
    32 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by proptrade13, Today, 11:06 AM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    34 views
    0 likes
    Last Post love2code2trade  
    Started by cls71, Today, 04:45 AM
    2 responses
    10 views
    0 likes
    Last Post eDanny
    by eDanny
     
    Started by kulwinder73, Today, 10:31 AM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Erick  
    Working...
    X