Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
High/low based on duration
Collapse
X
-
You guys are terrific!! Love you!! This works great. I see I needed to add
privatedouble hh = 0;
privatedouble ll = 0;
in the variables region.
One other question...I need to bring this into a strategy I'm building, should I keep it as an indicator and just try and call it in the strategy, like I might call the CCI? Or should I try and copy in the code?
Comment
-
Hi Josh and Ben
I'm having difficulty getting comparisons to work with the highest high and lowest low we plotted. It keeps making NT crash. This is what I'm doing that it doesn't seem to like the following as conditions for entry:
int barssincebarrier = GetBar(startDateTime);
if highlow().LowestLow[0] > (MIN(Low, barssincebarrier)[0]) && etc.
and it also doesn't respond to:
if ((highlow().HighestHigh[0] - highlow().LowestLow[0]) < 80 * TickSize)
Can you tell me what is wrong with these two statements? I've just referenced the indicator you helped me with in these statements to get to the values.
All I want to do is check that since the end of the highesthigh/lowestlow period price has moved either higher or lower than those barriers as a condition of entry. I also want to check that the distance between the high and low barriers is less than 80 pips.
Last edited by Red Fish; 09-05-2008, 07:48 AM.
Comment
-
Hi Josh
I tried copying in the code from the indicator to the strategy, and it doesn't like the syntax. I checked it through, and I can't see any differences, so I don't know why the syntax is okay in the indicator but not in the strategy. Can you have a look at it please?
Attached Files
Comment
-
You can't create plots in a strategy, but for this case you don't need to. Delete those lines along with these:Code:Add(new Plot(Color.FromKnownColor(KnownColor.Green), PlotStyle.Line, "HighestHigh")); Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "LowestLow"));
To use your values just reference the ll and hh.Code:HighestHigh.Set(hh); LowestLow.Set(ll);
Josh P.NinjaTrader Customer Service
Comment
-
Decrease the amount of data you are backtesting on. Please note: The way the code is designed if you are running it on a chart that never has a bar that is timestamped exactly as you have defined myEndTime then it will just loop through every single bar on your chart. CPU intense. It just keeps going and going hence the freeze.
Make sure your myEndTime actually exists as a timestamp on a bar in your chart.Last edited by NinjaTrader_JoshP; 09-05-2008, 10:00 AM.Josh P.NinjaTrader Customer Service
Comment
-
60 days can easily be a ton of bars. The issue is the one about finding a bar with the specific timestamp that you defined as the EndTime. Please look at a chart manually first to ensure that such bars exist on a consistent basis. Your code will go through that loop every time your StartTime is met. If it can't find the bar associated with the exact EndTime it will go all the way to the beginning of the chart running through hundreds of calculations. Multiplied by doing that 60 times. You'll run out of computer resources pretty fast.Josh P.NinjaTrader Customer Service
Comment
-
Red Fish,
Then you need to just debug what is happening in your strategy and why it is hanging. http://www.ninjatrader-support.com/v...ead.php?t=3418
Josh P.NinjaTrader Customer Service
Comment
-
Josh, but am I right in thinking I can't get any output in the output window until it has run on a chart first...that's how I've been using the output window - compile the code and then run it on a chart then go to the output window. As I can't run it on a chart without it locking up my whole computer I can't see how I can view anything on the output window.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
671 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
379 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
111 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
575 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
582 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment