• 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

Real-Time Price Detection

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

    Real-Time Price Detection

    How do identify the current price to compare against say the SMA? If I wanted to do something like:

    IF Current price crosses below the SMA... [Do something]

    Right now in the price section I only see open close high low, but those are defined after a candlestick bar is done. I need to keep track of the price and compare in real-time.

    Please advise.

    #2
    Hello chaddweston,

    Thanks for your post and welcome to the NinjaTrader forums!

    If you want to see real time data then you would need to set your codes "calculate mode" to Calculate.OnEachTick. In this mode Close[0] IS the current price on the right edge as the bar forms and Close[1] is the close of the previously completed bar.

    One caution though is that if you check to see if the current tick has crossed the SMA you need to understand that on the next tick it could cross back and this could occur hundreds of times in the forming bar. So you would need to give some thought about how to deal with that. On the other hand, staying with Calculate.OnBarClose, Close[0] points to the last completed bar and it will not change on you...

    References: http://ninjatrader.com/support/helpG...?calculate.htm

    You can have your strategy run Calculate.OnEachTick and have some parts run once per bar and other parts run on each tick. Here is a link to a reference example that reviews and demonstrates how to do this: http://ninjatrader.com/support/forum...ad.php?t=19387
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by XimoTrader, Today, 12:57 PM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Started by FxInception, Today, 12:27 PM
    2 responses
    8 views
    0 likes
    Last Post FxInception  
    Started by siroya, Today, 10:34 AM
    1 response
    20 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Started by Leeroy_Jenkins, Today, 11:22 AM
    2 responses
    12 views
    0 likes
    Last Post Leeroy_Jenkins  
    Started by RedDuke, Today, 10:27 AM
    2 responses
    15 views
    0 likes
    Last Post RedDuke
    by RedDuke
     
    Working...
    X