Broker/Data: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Favorite Futures: ES, CL, EUR/USD, TF
Posts: 171 since Aug 2009
Thanks: 99 given,
found out the answer! OnMarketData works awesome!
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.
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
then I would need the ticks to be added.
The following user says Thank You to spinnybobo for this post: