Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Access Tick Data within BarsInProgress minute loop
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hello
I am writing an indicator in which have the requirements of COBC = true
Most everything is on Close to collect values
But there is a part of the indicator when I evaluate everything and then it has a condition that when price hits a certain level, I want this to be updated tick by tick
So it seems like because I went
The only thing I can think of is creating a boolean variable is like
and when it signals, startTick = true
Then in a separate block
I just didn't know if there was a better way?
I am also going to try adding a break; to the if statement but not sure the best way to do this either
any help would be great
thanks
Spencer
Can you help answer these questions from other members on NexusFi?
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
So as an update here is what I discovered
my new friend is OnMarketData !
I knew I needed some type of an event similar to OnOrderUpdate and OnExecution, but since this is not a strategy I didn't know what other events I could use.
Now that I am aware of this event (I heard of it before just never used it) and what I can use it for, I will keep my eyes on the lookout for ALL of the events available in NinjaTrader 7 as well as 8.
The events built in really did save the day
Here is what I was looking for. My strategy is COBC = true because if I did COBC = false and used FirstTickOfBar to help calculate things, it does not give the same exact values bar by bar on a consistent basis, so I could not go down that route.
I didn't want to Add(PeriodType.Tick, 1) because it takes FOREVER to load when you put it on the chart.
Plus this is Forex and I am not sure if FXCM adds the ticks as easy as futures for CQG. I would always get an error and this is not good if you are writing something for a client.
Therefore I wanted COBC = true, but when a certain price is reached, I wanted it to start monitoring it in real time tick by tick.
Enter the OnMarketData. It works great!
So since Ninja is event driven, and they seem to not have bugs in the events, I am definitely going to make myself aware of all of the available events.
This will probably only enhance my code making it "lighter" and easier to load as well as more accurate.
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61
Hey
yes I am aware it is only for real time data. so since this is just an indicator and does need it to be tick by tick for Historical, that is fine. I am mainly talking about situations in which you want to jump into tick right away
if it was a strategy and the stop needed to be trailed and I wanted to backtest it, then yes I would need to add tick data to the chart and handle it
However, in that situation I would use IOrder states to trigger as opposed to a boolean like