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)
Rather than importing directly via File->Utilities->Import Ninja Script i unziped the attachment and copied the .cs folder into NT and opened through Edit NinjaScript and then complied.
The following are the errors in detail.
I finally downloaded and installed the latest version of both VisualSMAMTF and VisualEMAMTF. I followed the directions carefully and removed the previous assembly and restarted NT. All were working fine with the old version. Now I am having the same problem with both SMA and EMA. I want to plot a bar graph on an indicator panel with the settings shown in the attached screen shot of the “Indicator Setup Menu.” I am trying to plot an 8 period Renko type onto a 450 period Tick chart. What I get is the result shown in attachment labeled “Renko Setting.” I.e., nothing, not even the proper label. I merely change the period type from Renko to Minute and everything looks fine, as shown in the attached screen shot labeled “Minute Setting.” A list of the errors shown in the NinjaTrader Log is shown in the fourth screen shot.
Any ideas as to what is going on?
Thanks for your help and the wonderful indicators. Looking forward to getting back to “normal.”
The indicator does not work with Renko bars, I have to take out that options. This is due to a NinjaTrader limitation, as normally you cannot add other bar series dynamically.
There would be two workarounds possible to solve the problem:
-> add as many secondary bar series to the indicator as there are options
-> code a VisualSMA which works on RenkoBars only
I have not had the time to further enquire into this. I am currently waiting on feedback on another problem, which limits the use of the indicator when called by a strategy.
Here is an update of the VisualSMA and VisualEMA indicators.
Those who dare please test:
- I have removed the option for Renko bars, this did not work anyhow, as the Renko bars cannot be added to the indicator dynamically.
- There was a bug discovered by @mborin, which prevented that the indicator could be accessed via a strategy using Rising(VisualSMA) or Rising(VisualEMA).
The indicators should work now. Those who dare, please test the attached assemblies and let me know whatever happens.
Before installing the new versions, please remove the prior versions via File -> Utilities -> Remove Ninjascript Assembly.
I just want to explain another time, how the indicators work and can be correctly accessed. The explanation refers to the VisualSMA but also applies to the VisualEMA
Strategy mode
Indicator collects data from secondary bar series. When a bar of the secondary bar series is complete, the value is displayed on the chart. This typically results in a step function.
One-Tick Repaint Mode
This mode corrects a weakness of the multi-barseries concept of NinjaTrader. OnBarUpdate() will be triggered for the primary bars and then for the secondary bars. Now imagine that you have a 15 min chart and want to display an hourly SMA. Then t the full hour NinjaTrader will first run the primary bars (allowing to write values to the chart) and then the secondary bars calculating the values from the hourly bars, which it should have written to the primary 15 min bars during the prior run of OnBarUpdate(). This mean that for the bar close of the 15 min bar, the last tick of the 60 min bar cannot be taken into account, because it is not available.
The solution adopted is to repaint the value to the prior bar with the first tick of the new 15 minute bar. The indicator therefore repaints the prior bar a single time, but only uses information from the prior 60 minute bar, which is unfortunately processed after the 15 min bar.
The result also is a step function, but the lag of 1 bar is eliminated when real-time data is processed.
Visual Mode
With each incoming tick the distance between the last node - in the example above that would be the close of the hourly bar - and the current value of the indicator is repainted by using a linear interpolation. In COBC = false mode you can see the last leg moving up and down.
Accessing the indicator
In strategy mode it is pretty easy to access the indicator via another indicator or a strategy. This is possible because the indicator does not repaint. However, there is a limitation. Any multi-timeframe indicator that loads range bars, cannot be properly accessed via another indicator or strategy. Sometimes the indicator values will be vertically shifted, that is the indicator values would be false.
Therefore the VisualSMA cannot be accessed when the period type selected via the indicator parameters is set to "Range".
If you want to access the VisualSMA in One-Tick Repaint or Visual mode you would need to take into account that the indicator repaints. When the indicator is accessed in One-Tick Repaint mode, you need to access the last 2 values for your strategy and let it recalculate. When you access the indicator in Visual mode, things are more complicated, as the indicator repaints over the last swinging leg. Here you would need to call all indicator values that cover this period.
The indicator offers you a Public IntSeries, which can be accessed and which tells you how many bars it paints back for the currennt value. The IntSeries can be accessed as VisualSMA(period, false, false, thisCalcMode, thisPeriodType, thisPeriodValue, thisPriceType).Repaint[0] and then used to collect the last indicator values. You can then use the integer to loop through the bars back to the last node, which is used as anchor point.
For those who are interested I have attached a model indicator that accesses the VisualSMA and plots the values on a chart. Please copy the model indicator into the directory NinjaTrader 7 -> bin -> custom -> Indicator and compile. It will only compile, if you have the VisualSMA installed.
In case that you have installed the model indicator or any other indicator or strategy that accesses the VisualSMA, do not forget to remove those indicators/strategies first before you uninstall the assembly.
Hi guys, I've just finished reading this post. I must say it's really great. Thanks
I don't have strong programming skills and I am struggling trying to code a MTF strategy in NT7. I am sure this is simple and really would appreciate your help.
I have a few strategies that run on 10-15 min time frames, however I notice there are multiple fake signals that occur due to the fact that the strategies take-profit is very close and NT7 often enters&exits the trade within the same candle, ignoring the real price path. I think this issue could easily be solved by working on a Multi-Time-Frame Strategy. I tried using the Visual EMA when coding my strategy but it doesn't work. Probably because I am using the wizard to create the new strategy.
Lets assume I want to run the below strategy on 1 min time frame, but I want to use indicators (in the example below the 25 and 50 SMA) that refers to a 15 min time frame, and ALSO that I want to enter in position not more than once every 15 minutes. Could somebody please help me to figure out what code to use: