Help Guide - http://www.ninjatrader-support.com/H...entDayOHL.html
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
1st Hour High/Low
Collapse
X
-
So that I am on the same page as you...
- What do you want to do, have an indicator that plots the day's highest high and lowest low?
- If yes, there is no need to create a custom indicator, just open a chart and add the CurrentDayOHL indicator.
- Is there something else you want to do? I yes, please let me know and I can provide additional assistance.RayNinjaTrader Customer Service
Comment
-
Ray,
I want to plot the highest high and lowest low of the first 30 minutes of the trading session. For this I would need a property that can look at the highs/lows from 930am EST till 1000am EST. Then plot the highest high and lowest low from that period.
Thanks
Comment
-
Thanks for the clarification.
Then you will have to create a custom indicator for sure. In english...
If the time is between your session start time and session start time + 30 mins plot the value of the current high.
Same for current low.
To access the current high or low:
CurrentDayOHL().CurrentHigh[0]
CurrentDayOHL().CurrentLow[0]RayNinjaTrader Customer Service
Comment
-
Here is partial code
if (currentDate != Time[0].Date)//if new day
{
pHigh = 0; // re-initialize PeriodHigh,PeriodLow for the new day
pLow = 9999;
}
if (ToTime(Time[0]) > 93000 && ToTime(Time[0]) < 100000)
{
if (High[0] > pHigh) { pHigh = CurrentDayOHL().CurrentHigh[0] ; }
if (Low[0] < pLow) { pLow = CurrentDayOHL().CurrentLow[0] ;}
PeriodHigh.Set(PHigh);
PeriodLow.Set(PLow);
}
Comment
-
Just looking through this thread, it appears over complicated. Would the following not do the job? - in OnBarUpdate()
if (ToTime(Time[0]) == 100000)
{
pHigh = CurrentDayOHL().CurrentHigh[0];
pLow = CurrentDayOHL().CurrentLow[0];
}
if (ToTime(Time[0]) >= 100000)
{
periodHigh.Set(pHigh);
periodLow.Set(pLow);
}
There would be nothing plotted until 1000hrs, then you will get the highest and lowest price for the day so far up to 1000hrs, plotted as a straight line for the rest of the day. I think that is what is being attempted, or maybe I misunderstood something.
MJT
Comment
-
MJT,
That worked. It always seem easier after the problem is solved. Thank you so much.
Ray
Also, are there any examples to code this similar strategy to be used in Market Analyzer? When close > Phigh, then flash Green.
When close < Plow, then flash Red.
THanks again
Comment
-
You would have to code a new indicator. I would code it and set the indicator plot value to > 0 when condition A is true, < 0 when condition B is true.
Then you can add this indicator to the Market Analyzer and set color conditions based on the indicator value.RayNinjaTrader Customer Service
Comment
-
1st hour high/low
I just stumbled across this post. CurrentDayOHL would not work if the chart begins at 12:00am. If you truly want only the 1st hour after the market opens try:
private double Hour1High =0.0;
private double Hour1Low =0.0;
OnBarUpdate...
if (currentDate != Time[0].Date)
Hour1High = 0;
Hour1Low = 9999;
if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) < 103000)
{
if (High[0] > Hour1High)
Hour1High = High[0];
if (Low[0] < Hour1Low)
Hour1Low = Low[0];
}
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Gerik, Today, 09:40 AM
|
2 responses
6 views
0 likes
|
Last Post
by Gerik
Today, 10:04 AM
|
||
Started by RookieTrader, Today, 09:37 AM
|
2 responses
11 views
0 likes
|
Last Post
by RookieTrader
Today, 10:02 AM
|
||
Started by alifarahani, Today, 09:40 AM
|
1 response
7 views
0 likes
|
Last Post Today, 10:01 AM | ||
Started by KennyK, 05-29-2017, 02:02 AM
|
3 responses
1,285 views
0 likes
|
Last Post Today, 09:35 AM | ||
Started by AttiM, 02-14-2024, 05:20 PM
|
11 responses
186 views
0 likes
|
Last Post Today, 09:28 AM |
Comment