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!
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
NinjaTrader
Real-Time Price Detection
Collapse
X
-
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
-
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.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kevinenergy, 02-17-2023, 12:42 PM
|
118 responses
2,778 views
1 like
|
Last Post
by kevinenergy
Today, 05:41 AM
|
||
Started by briansaul, Today, 05:31 AM
|
0 responses
9 views
0 likes
|
Last Post
by briansaul
Today, 05:31 AM
|
||
Started by traderqz, Yesterday, 12:06 AM
|
11 responses
28 views
0 likes
|
Last Post Today, 05:11 AM | ||
Started by PaulMohn, Today, 03:49 AM
|
0 responses
8 views
0 likes
|
Last Post
by PaulMohn
Today, 03:49 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
1 response
10 views
0 likes
|
Last Post Today, 02:18 AM |
Leave a comment: