but you would like to display on panel 1 of a minute chart
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Indicator based on daily values displayed on minute chart
Collapse
X
-
fiddy,
NinjaScript does supports multi-time frame and instruments in a single script. NinjaTrader does provide two examples of this: SampleMultiInstrument and SampleMultiTimeFrame.
It would be helpful for you to review those sample strategies.
Here is also another example to help you get started:
protected override void Initialize()
{
Overlay = true;
CalculateOnBarClose = false;
Add(PeriodType.Day, 1); //Add D1 DataSerie
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1) //For D1 dataseries
{
double HighD1 = Highs[1][0];
double LowD1 = Lows[1][0];
}
if (BarInProgress == 0) //For current DataSeries (M1)
{
double variable = High[0] - Low[0];
}
}
You can read more about multi-time frame and multi-instruments in the following link: http://ninjatrader.com/support/helpG...nstruments.htmBobby Y.NinjaTrader Customer Service
-
Bobby, below is what i have currently - it plots correctly when the time frame is daily
but doesnt plot anything when the timeframe is minutes. what am i missing?
i want to use this indicator on minute charts but for the ranges to be based on daily data high/lo/ atr etc
protected override void Initialize()
{
CalculateOnBarClose = false;
Add(PeriodType.Day, 1);
Overlay = true ;
}
protected override void OnBarUpdate()
{
if (CurrentBar < 1) return;
HighLimit .Set(Highs[1][1] + 1*ADX(14)[0]);
LowLimit .Set(Lows[1][1] - 1*ADX(14)[0]]);
}
Comment
-
fiddy,
Thanks for the response. After looking into this, I've included an edited version of your code.
Code:protected override void Initialize() { Add(PeriodType.Day, 1); CalculateOnBarClose = false; Overlay = true; } protected override void OnBarUpdate() { if (CurrentBars[1] < 1) return; if (BarsInProgress == 0) { HighLimit.Set(Highs[1][1] + 1 * ADX(14)[0]); LowLimit.Set(Lows[1][1] - 1 * ADX(14)[0]); } }
Bobby Y.NinjaTrader Customer Service
Comment
-
hi Bobby, i have amended my code to reflect your latest update but this seems to have made it worse. now it doesnt show anything on the daily or minute time frames . ive attached the script for your referenceAttached Files
Comment
-
i didnt look at ur file bc i dont like downloading stuff from users. so i have to ask. did u include the plots correctly? further: your ADX will be a primary timeframe ADX, is that intentional?
i included my full code which does plot something on my minute timeframe.
Code:protected override void Initialize() { Add(PeriodType.Day, 1); CalculateOnBarClose = false; Overlay = true; Add(new Plot(Color.Green, "HighLimit")); Add(new Plot(Color.Orange, "LowLimit")); } protected override void OnBarUpdate() { if (CurrentBars[1] < 1) return; if (BarsInProgress == 0) { Value.Set(Highs[1][1] + 1 * ADX(14)[0]); LowLimit.Set(Lows[1][1] - 1 * ADX(14)[0]); } } #region Properties [Browsable(false)] [XmlIgnore()] public DataSeries LowLimit { get { return Values[1]; } } [Browsable(false)] [XmlIgnore()] public DataSeries Default { get { return Values[0]; } } #endregion
Last edited by BigRo; 12-29-2015, 08:40 AM.
Comment
-
thanks Bobby / BigRo - i made some amendments to your code to fix up how it should work (ADX bars array 1) but it is still not ploting correctly on minute chart
i have attached picture of how i expected it to look and how it currently does.
As you can see it is only plotting the most recent day on the minute chart and the value seems to be incorrect.
Based on the daily chart values of 107.65 for price and 29.57 for ADX - id expect a flat line across approx 138 on the minute chart for the most recent day but currently it is at 162.and nothing is displayed for previous days
protected override void Initialize()
{
Add(new Plot(Color.Orange, "HighLimit"));
Add(new Plot(Color.Green, "LowLimit"));
Add(PeriodType.Day, 1);
CalculateOnBarClose = false;
Overlay = true;
}
protected override void OnBarUpdate()
{
if(CurrentBars[1] < 1) return;
if(BarsInProgress == 0)
{
HighLimit.Set(Highs[1][1] + 1 * ADX(BarsArray[1],14)[0]);
LowLimit.Set(Lows[1][1] - 1 * ADX(BarsArray[1],14)[0]);
}
}
Comment
-
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Tim-c, Today, 10:58 AM
|
0 responses
1 view
0 likes
|
Last Post
by Tim-c
Today, 10:58 AM
|
||
Started by traderqz, Yesterday, 09:06 AM
|
3 responses
21 views
0 likes
|
Last Post Today, 10:36 AM | ||
Started by f.saeidi, Today, 10:19 AM
|
1 response
5 views
0 likes
|
Last Post Today, 10:31 AM | ||
Started by kujista, Today, 06:23 AM
|
5 responses
18 views
0 likes
|
Last Post
by kujista
Today, 10:26 AM
|
||
Started by traderqz, Today, 12:06 AM
|
3 responses
6 views
0 likes
|
Last Post Today, 09:41 AM |
Comment