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!
See more
See less

Partner 728x90

Collapse

How to get NT8 Custom PreviousDayOHLC to plot PreviousDay RTH values Only

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AdeptistJune
    replied
    Hello Kate,

    I'm a 100 tick chart. But I think I understand the issue Im having. It's the open time of the Rth Session.

    Leave a comment:


  • NinjaTrader_Kate
    replied
    Hello AdeptistJune,

    Thank you for your reply.

    What's the time frame of the chart you're testing on? I'm finding it works as I would expect on a series that would have a bar closing at 8:30 am, so 30 minute, 15 minute, 5 minute, 3 minute, 2 minute and 1 minute series all work. The issue you're seeing is that if the primary series doesn't have a bar ending at that exact time the RTH session starts, the initial values for the day don't get assigned, so you'd have to play around with that a bit to get the plots right on the primary series.

    Please let us know if we may be of further assistance to you.

    Leave a comment:


  • AdeptistJune
    replied
    Good Morning Kate,

    You are very right, this code is tricky since we need the prior day's value before we can start plotting. The sample code you provided gives plot values of zero.
    Attached Files

    Leave a comment:


  • AdeptistJune
    replied
    Hello Kate,

    I'm about to look at the code now and see what I can come up with.

    Leave a comment:


  • NinjaTrader_Kate
    replied
    Hello AdeptistJune,

    Thank you for your patience.

    This was a little tricky since we need the prior days' values before we can start plotting. This example isn't perfect but you should get an idea of the general direction. We first get the first day's values, then use them to plot on the primary series once we have a full RTH session of values. There's still issues with this as it doesn't plot values for the second day, so I'm still working on that, but this should give you a jumping off point, at least!

    Please let us know if we may be of further assistance to you.
    Attached Files

    Leave a comment:


  • AdeptistJune
    replied
    Good morning Kate,

    Did you get a chance to work on the example?

    Leave a comment:


  • AdeptistJune
    replied
    Hello, Kate,

    Thanks.

    Leave a comment:


  • NinjaTrader_Kate
    replied
    Hello AdeptistJune,

    Thank you for your reply.

    I'm working on an example but have run out of time in my day today to complete it. I will finish that example up and get that to you tomorrow.

    Thanks in advance; I look forward to assisting you further.

    Leave a comment:


  • AdeptistJune
    replied
    Hello Kate,

    I use a custom extended hours template for my chart, because my strategy compares, for example, ATH OPEN versus RTH OPEN. And when I called RTH data series in a script, if I write code, lets say, if time > 1700 or time < 0830 and I wish to use those RTH plots values, I will not get a live trade. It will show historically, but while running the script live, it will not take a trade. That's why I created a custom CurrentdayOHL indicator to by pass that little issue.

    Leave a comment:


  • NinjaTrader_Kate
    replied
    Hello AdeptistJune,

    Thank you for your post.

    You don't need to make a custom version of PriorDayOHLC to have that use RTH values - the built in PriorDayOHLC indicator can just be applied to an RTH chart or called on an RTH data series in a script and it will return those values for the RTH session.

    Please let us know if we may be of further assistance to you.

    Leave a comment:


  • How to get NT8 Custom PreviousDayOHLC to plot PreviousDay RTH values Only

    How can I take the NT8 custom PreviousDayOHLC iand get it to show RTH previous day OHLC instead of the overnight included?

    I have use SessionIterator, Bars.IsFirstBarOfSession, etc. But nothing seems to work. I did take NT8 custom CurrentDayOHL and got those values to plot only the RTH OHL. Here's my example of that:

    if (!Bars.BarsType.IsIntraday) return;

    lastDate = currentDate;
    currentDate = sessionIterator.GetTradingDay(Time[0]);


    if (Time[0] >= sessionIterator.ActualSessionBegin && Time[0] <= sessionIterator.ActualSessionEnd || Bars.IsFirstBarOfSession)
    //if (Bars.IsFirstBarOfSession)
    //if (lastDate != currentDate || currentOpen == double.MinValue)
    {
    currentOpen = Open[0];
    currentHigh = High[0];
    currentLow = Low[0];

    //Print(Time[0] + "|" + "lastDate" + lastDate + "|" + "currentDate" + currentDate);
    }

    currentHigh = Math.Max(currentHigh, High[0]);
    currentLow = Math.Min(currentLow, Low[0]);

    //Print(String.Format("Time[0]: {0} lastDate: {1} currentDate: {2}",
    //Time[0], lastDate, currentDate));

    if (ShowOpen)
    CurrentOpen[0] = currentOpen;

    if (ShowHigh)
    CurrentHigh[0] = currentHigh;

    if (ShowLow)
    CurrentLow[0] = currentLow;

    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 1)
    return;

    if (Times[0][0].TimeOfDay >= new TimeSpan(17, 00, 00) || Times[0][0].TimeOfDay <= new TimeSpan(08,30, 00))
    {
    CurrentOpen[0] = CurrentOpen[1];
    CurrentHigh[0] = CurrentHigh[1];
    CurrentLow[0] = CurrentLow[1];
    }

    Thanks.

Latest Posts

Collapse

Topics Statistics Last Post
Started by benmarkal, Yesterday, 12:52 PM
3 responses
23 views
0 likes
Last Post NinjaTrader_Gaby  
Started by helpwanted, Today, 03:06 AM
1 response
19 views
0 likes
Last Post sarafuenonly123  
Started by Brevo, Today, 01:45 AM
0 responses
11 views
0 likes
Last Post Brevo
by Brevo
 
Started by pvincent, 06-23-2022, 12:53 PM
14 responses
244 views
0 likes
Last Post Nyman
by Nyman
 
Started by TraderG23, 12-08-2023, 07:56 AM
9 responses
388 views
1 like
Last Post Gavini
by Gavini
 
Working...
X