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 Island_Boy_Trading, Today, 07:39 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChristopherJ  
    Started by cmarkb, Today, 07:19 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by wjadevries, Today, 03:29 AM
    1 response
    14 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by Oracletrades, Yesterday, 09:10 PM
    1 response
    118 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by ginx10k, Today, 07:04 AM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X