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)
Hi, Im trying code daily 5-day-SMA on 5-minute chart, but it doesnt work, it doesnt show anything on 5minChart
could anybody help me please?
Log:
28.1.2014 16:18 Default Error on calling 'OnBarUpdate' method for indicator 'DenniSMA' on bar 1: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
Code:
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Add(PeriodType.Day, 1);
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{ if(CurrentBar < 1)
return;
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
Plot0.Set(SMA(Closes[1], 5)[0]);
}
Can you help answer these questions from other members on NexusFi?
There is an easier way than writing an indicator to do this. Here is what i did for the chart below.
1) Created new chart with 50 days of 5 minute data.
2) Added another data series, daily, 50 days
3) for the daily data series change the following: (see picture)
A) Set the type to "line on close"
B) Set the color to "transparent"
C) Set the panel to panel #1 (important!!)
D) Turn off the "Plot executions"
E) hit Okay, You will now have a chart showing only the 5 minute data (see picture)
4) open the indicators, select SMA. In the indicator panel change the input series to the daily data series. (See picture)
You now have an sma(5) from daily bars showing on a 5 minute data chart.
Hope this helps.
Be yourself; everyone else is already taken. Oscar Wilde
If you want to keep things simple you can just convert a 5 sma on a daily to the 5 minute chart :
There are twelve 5 minute periods per one hour multiplied by twenty-four hour per day multiplied by five days (12x24x5 = 288)
So a daily 5 SMA is roughly equivalent to a 288 SMA on a five minute chart (assuming your chart is a 24hr chart). Only a few ticks difference between them.
It would be nice if the 288SMA would be the same on a 5min chart as a true daily sma on a same chart.
I use NT and ThinkOrSwim. TOS has a Daily SMA indicator built in and it is awesome. Why doesn't NT have it also.
The use of the Daily SMA is what Brian Shannon uses for his day trading and it is a great aid.
Is there a Daily SMA available as a free indicator for NinjaTrader? I would love to see it!