Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Daily to Intraday
Collapse
X
-
Hi Bertrand, Thank you for your prompt reply.
To be more specific, I am looking for the True High and True Low of the previous day. This is calculated as the higher of the previous day's high and close 2 days ago for the true high and the lower of the previous day's low close 2 days ago for the true low.
I hope that it can be achieved
Comment
-
kaywai,
You would need to use PriorDayOHLC and grab the highs of all the days you are interested in and then running math calculations to determine your true high.
You can use GetBar() to get the correct [] index value to plug into PriorDayOHLC() to get different days. Running PriorDayOHLC() on a bar index [] of yesterday will give you the high/lows of the day before yesterday.Josh P.NinjaTrader Customer Service
Comment
-
ok. what am i doing wrong here?
#region Variables
privatedouble truelow = 0;
privatedouble truehigh = 0;
#endregion
protectedoverridevoid Initialize()
{
CalculateOnBarClose = true;
Overlay = false;
PriceTypeSupported = false;
}
protectedoverridevoid OnBarUpdate()
{
double value1 = Bars.GetSessionBar(2).Close;
double value2 = PriorDayOHLC().PriorLow[0];
double value3 = PriorDayOHLC().PriorHigh[0];
double truerange = 0;
{
if (value3 > value1)
{truehigh = value3};
elseif (value3 < value1)
{truehigh = value1};
if (value2 > value1)
{truelow = value1};
elseif (value2 < value1)
{truelow = value2};
truerange -= truehigh - truelow;
}
}
Last edited by kaywai; 01-19-2010, 07:17 AM.
Comment
-
-
Hi Bertrand, No errors in the script now but getting zero output. I tried using Print function but not sure where to find output. The script wouldn't accept TraceOrders = true either. Would you mind taking a look and giving some pointers?
I'm using the previous day's true range to determine the possible trading range for today based on today's open. True Range is defined as truehigh - truelow, where true high is the higher of yesterday's high or the close of 2 days ago, while true low is the lower of yesterday's low or the close of 2 days ago.
Once those point have been determined, I would like to draw squares at those prices.
I've attached the script. Thanks in advance!Attached FilesLast edited by kaywai; 01-20-2010, 07:17 AM.
Comment
-
Hi Bertrand,
For some strange reason (according to the output), lines 56-63 (calculation of truehigh) are not working according to script whereas lines 64-71 (calculation of truelow) are working properly. Would you mind having a look? The lowest 2 squares (rebodownentry & rebodownexit) are not drawn because they are off the chart. Is it possible to have them displayed?
The output is attached. I've also attached the script as I had to make some changes.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
621 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
359 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
105 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
562 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
566 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment