reference last bar (of week) - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

reference last bar (of week)
Started:October 13th, 2014 (04:45 AM) by yeshe Views / Replies:231 / 2
Last Reply:October 21st, 2014 (11:23 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

reference last bar (of week)

Old October 13th, 2014, 04:45 AM   #1 (permalink)
Elite Member
San Fransisco Ca
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: IB
Favorite Futures: forex
Posts: 16 since Jan 2014
Thanks: 5 given, 1 received

reference last bar (of week)

Hello dear forum,

Can you help me with the following?

I want to have an indicator that refers to the last bar of the week (in historical data) for all open charts.

so for a minute chart it is the last minute bar of the week
for 1 hour chart is the last hour of the week
1 day chart it is friday

how to program this in ninjatrader
for example

if (Last bar of the week = true)

many tx in advance


Last edited by yeshe; October 13th, 2014 at 04:46 AM. Reason: typing mistake
Reply With Quote

Old October 13th, 2014, 04:45 AM   #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.


Old October 21st, 2014, 11:23 AM   #3 (permalink)
Elite Member
Heidelberg, Germany
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Stocks
Posts: 11 since Jun 2014
Thanks: 6 given, 11 received

The question is always whether the last bar of the week was also the last trading day in that week. Theoretically, if you account for public holidays, etc, you would need to know in advance when the market closes.

The simple approach is on the next bar into the new week to notice that you are in a new week (which for your requirement) will work. Something like this:

int dayOfWeek = 0;

void OnBarUpdate()
    if (Time[0].DayOfWeek < dayOfWeek)
        // it seems that week has started new again, do your calculations for last week
    dayOfWeek = Time[0].DayOfWeek;

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > reference last bar (of week)

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
thinkscript reference situhold ThinkOrSwim 3 September 12th, 2014 12:58 PM
tried to reference too many bars back malibu TradeStation 4 June 2nd, 2014 03:33 PM
External reference Sterlingtrader MultiCharts 1 May 2nd, 2014 04:50 AM
How to step forward bar by bar (F12) with full bar not half bar? mercyman MetaTrader 1 October 23rd, 2012 04:49 PM
plot axis reference for bar style SARdynamite NinjaTrader Programming 1 July 17th, 2010 06:02 AM

All times are GMT -4. The time now is 09:36 PM.

Copyright © 2016 by All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts

Page generated 2016-10-24 in 0.09 seconds with 19 queries on phoenix via your IP