Quite often we need to add a time selector to NinjaTrader indicator or strategy parameter list. The usual to do this would be like this:
The task was to get selected chart trader account pnl and print its values out on a chart trader. The numeric value at the bottom of this custom chart trader reads the live pnl and also updates when it changes.
In order for the value to get updated you have to additionally inherit the strategy class from INotifyPropertyChanged interface. Once you do that you also have to implement it like this:
Many times we get a situation where we want to plot some lines on the chart. Sometimes these lines need to come on and off and when they would come off their value would be zeroed out or they might become irrelevant such as become n/a.
This topic has been breaking my head for over a few years now for quite a few reasons. Let's review a few of the main ones.
First of all we need to say that NinjaTrader architecture has two possible ways of executing inside the OnBarUpdate method which are either on each incoming tick or on each incoming bar close. Now, I will skip the on price change one which I don't use at all.
It has been a long time question and I was thinking on dedicating a proper page to this topic and procrastinating this discussion for years until I remembered that I have a blog!!!))
Let's imagine you are someone who knows nothing about coding and strategy development. An absolute blank or as we say "tabula rasa". Where should one start?
NinjaTrader offers and amazing opportunity for all of us! It has a wide community and you are free to make products and grow together with the platform.
I decided to make a quick guide on how this works in this post since I do get this asked quite often and honestly it was a bit confusing right from the start on how this actually works.
This is a painful spot for NinjaTrader and I have already written quite a few blog posts on this but just recently I came across a quick walking stick that I would like to share.
Basically to outline a problem imagine two bars. You get filled on one bar lets say at 15:00, next bar is 15:05 and previous bar is 14:55. So you get filled whilst the 14:55 - 15:00 bar is forming, so a bar with 15:00 close time.
Hello guys! Before I start a long story for this post I really want to thank the support team from NinjaTrader who have helped a lot to clarify the further discussed topic and more than that have actually clarified and helped with far more questions so a big thank you for all of them if any are reading this post!
This is a very popular topic. We can add buttons to pretty much anything in NinjaTrader using the same principles. Buttons can be added from AddOn, Indicator or Strategy class doesn’t really matter. The approach is almost the same for all of them. In this article, I will go through the main principles that you need to understand when adding buttons.
Let’s imagine a scenario where we need to look back at High and Low of a 9:30 bar close during the day. How would we do this?
First of all, inside the OnBarUpdate method, you would need to set look update like this:
var today = Time[0];
var dateTime = new DateTime(today.Year, today.Month, today.Day, 9, 30, 0);
Hello guys! More code snippets here! So, NinjaTrader offers a default function for you to set your stop size which is:
SetStopLoss(CalculationMode.Currency, 200);
Easy done! Just put this into the OnState.Configure and you are pretty much done and for many cases, this can be enough, however, for most of the cases that require a careful and more controlled approach to stop handling this is not enough at all.
DI+ DI- is a great play around indicator that I built for NinjaTrader. It is based on a few very simple yet effective concepts Welles Wilder came up with ages ago. You can build quite a few strategies using these indicators and apply them as filters and tools in quite a few trading scenarios.
In this article, I will give out a secret that will save you some headache time. I bet many of you might have come across this issue already and if you have not then you will 100% meet it if you ever design a multi-timeframe trading system for NinjaTrader where one of the symbols is slower than the other.
You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.”.
As we all know, NinjaTrader can be executed in two main modes. Either OnEachTick or OnBarClose. There is also OnPriceChange but we are not going to talk about it in this article.
OnEachTick and OnBarClose control how the OnBarUpdate is called during execution. When execution on EachTick whenever a new tick of data arrives into NinjaTrader the OnBarUpdate is called.
Hello everyone! If you have not read the first part of this article yet it might be a good idea. Nevertheless, this time we will be looking at the case of why you can get this error on live market or during market replay in NInjaTrader.
“Sell stop or sell stop limit orders can’t be placed above the market. Strategy submitted an order that generated the following error - order rejected. Strategy has sent cancel requests, attempted to close the position and terminated itself.”
“Sell stop or sell stop limit orders can’t be placed above the market. Strategy submitted an order that generated the following error - order rejected. Strategy has sent cancel requests, attempted to close the position and terminated itself.” Carry on and read more to find out more!