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
New 5day or week high
Collapse
X
-
zachj, thanks for the post - the current day could be accessed per default via the CurrentDay.OHL indicator in NinjaScript - http://www.ninjatrader.com/support/h...nt_day_ohl.htm
For the current week, you would need to custom code a condition to keep track of it - this is not inbuild standard but on our suggestion list for potential future enhancement.BertrandNinjaTrader Customer Service
-
Would I do something like..
private double WeekHigh()
{
return (CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[0] && CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[1] && CurrentDayOHL().CurrentHigh[0] > PriorDayOHLC().PriorHigh[2] ........)
}
private void WeekHighMethod()
{
if (Close[0] > WeekHigh())
{EnterLong()}
}
I think putting the PriorHigh[1] sends it back 2 days? And PriorHigh[2] is 3 days back.
Comment
-
zachj, the index you apply would be based on the bars, so would not refer to 1 / 2 days back but literally the bars of the series you're working on.
To track you can start working for example with this snippet, it would reset the track on Monday for the new week -
if (Time[0].DayOfWeek == DayOfWeek.Monday && Bars.SessionBreak)
trackCurrHigh = High[0];
if (High[0] > trackCurrHigh)
trackCurrHigh = High[0];BertrandNinjaTrader Customer Service
Comment
-
I'm not understanding what that is doing and don't see anything in the manual about trackCurrHigh?
I guess that is picking up the high starting from monday but that will do we no good if it's wed im trying to look back 5 trading days. I can't believe there is no way to have it recognize the day high say 3days back.
What about creating and index 1
Add(PeriodType.Day, 5); This would make a 5day bar I think.
{
if (Close[0] > Highs[1][0])
{EnterLong()}
}
Comment
-
So when I add Index 1 as mentioned below, a 5day bar, what is the primary bar set at where can I see this or adjust the primary? Will it just be whatever chart time period I have pulled up, say I have a 5minute chart up. Or is this controllable in the backtest area? I wasn't quite understanding that from the manual.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rene69851, 05-02-2024, 03:25 PM
|
1 response
20 views
0 likes
|
Last Post
by rene69851
Today, 08:20 PM
|
||
Started by ETFVoyageur, Yesterday, 07:05 PM
|
5 responses
44 views
0 likes
|
Last Post
by ETFVoyageur
Today, 08:08 PM
|
||
Started by jpeep, 08-16-2020, 08:31 AM
|
13 responses
487 views
0 likes
|
Last Post
by notenufftime
Today, 07:39 PM
|
||
Started by realblubb, 04-28-2024, 09:28 AM
|
2 responses
32 views
0 likes
|
Last Post
by realblubb
Today, 07:35 PM
|
||
Started by bmarovets, Today, 06:33 PM
|
0 responses
12 views
0 likes
|
Last Post
by bmarovets
Today, 06:33 PM
|
Comment