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
Daily to Intraday
Collapse
X
-
kaywai, you could work this out be accessing the values returned by the PriorDayOHLC indicator / method -
Of course those would be tied to your session begin and end settings on the chart, so please ensure those are adjusted as needed then as you apply the final indicator.BertrandNinjaTrader Customer Service
-
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
-
Try using this if structure in the script, this should give you the correct trueHigh and trueLow values, you can then take it from there -
Code:if (value3 > value1) truehigh = value3; else truehigh = value1; if (value2 < value1) truelow = value2; else truelow = value1;
BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by samish18, Today, 01:01 PM
|
1 response
6 views
0 likes
|
Last Post Today, 01:25 PM | ||
Started by WHICKED, Today, 12:56 PM
|
1 response
8 views
0 likes
|
Last Post Today, 01:17 PM | ||
Started by cre8able, Today, 01:16 PM
|
0 responses
3 views
0 likes
|
Last Post
by cre8able
Today, 01:16 PM
|
||
Started by chbruno, 04-24-2024, 04:10 PM
|
2 responses
47 views
0 likes
|
Last Post
by chbruno
Today, 01:15 PM
|
||
Started by WHICKED, Today, 12:45 PM
|
1 response
11 views
0 likes
|
Last Post Today, 01:08 PM |
Comment