NexusFi: Find Your Edge


Home Menu

 





custom timeframe


Discussion in NinjaTrader

Updated
    1. trending_up 2,724 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 toulouse-lautrec 
Europe
 
Experience: Beginner
Platform: NinjaTrader
Posts: 75 since Jun 2009
Thanks Given: 15
Thanks Received: 53

Hello,
i was wondering if it might be possible to have an indicator perform on another individually adjustable timeframe, independent of the timeframe the current chart is set to? e.g. chart is set to 1000 ticks however indicator is based on 5 min.

if so, does anyone have an example they might share or code snippets?

greetings


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Prediction Markets Expiry Day: Trump Eyes War Exit, $230 …
Prediction Markets & Event Contracts
One Wallet Made $200K in Hours: AP Probes Polymarket Cea …
Prediction Markets & Event Contracts
Thursday May 28: GDP + Core PCE + Jobless Claims All at …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114



toulouse-lautrec View Post
Hello,
i was wondering if it might be possible to have an indicator perform on another individually adjustable timeframe, independent of the timeframe the current chart is set to? e.g. chart is set to 1000 ticks however indicator is based on 5 min.

if so, does anyone have an example they might share or code snippets?

greetings

This is possible. You can code an indicator that performs calculations on another adjustable timeframe. There are a few different solutions:


(1) You can simply add a second bar series to your chart and add an indicator to that bar series. If you do not wish to see it, you can set the second bar series to transparent. The inconvenient of this method is that your chart may suffer from non-equidistant bar spacing.

(2) You can code an indicator that loades secondary bars, which are used for calculations. I have coded a lot of these, and most versions are obfuscated, because it is pretty difficult to do and get a good result.

Examples are:

2a) VisualSMA and VisualEMA: They allow you to calculate the SMA and EMA from minute, tick, volume or Range bars irrespective of your main bar series on the chart. The non-equidistant bar spacing is gone, but you pay a price as the method introduces a little lag. Assume a 500 tick bar which closes at 2:35:42 PM (primary bar) and a 5 min bar which is used for calculating indicator values which closes at 2:35:00 PM. In that case the indicator value calculated from the 2:35:00 PM bar can only be displayed 42 seconds later, when the tick bar closes. You indicator now has a lag, which was not the case for solution (1). You cannot have it all, you will either get non-equidistant bar spacing or a lag. For backtesting this can be avoided, if you primary bar series is a 1-tick series. In that case you are in the best of all worlds, but the result - a 1 tick series on your chart - is not exactly visually appealing.

The indicators can be found here:

https://nexusfi.com/download/ninjatrader-7/indicators/942-download.html
https://nexusfi.com/download/ninjatrader-7/indicators/939-download.html

2b) Here is an open code indicator, which I have published, which allows to calculate the exact opening range of a minute based period on a tick, range or volume chart. The indicators works, but I have recently developed a better approach to the problem. Nevertheless, you could have a look at the code, as it is a genuine multi-timeframe indicator.

https://nexusfi.com/download/ninjatrader-7/indicators/937-download.html?view

3) It is also possible to calculate composite bars. For example, if you have a 5 min bar series, you can easily calculate indicators using an integer multiple of the 5 min bar period. You could produce a 10 min Stochastics, or a 35 min MACD.


Reply With Quote
Thanked by:
  #4 (permalink)
 toulouse-lautrec 
Europe
 
Experience: Beginner
Platform: NinjaTrader
Posts: 75 since Jun 2009
Thanks Given: 15
Thanks Received: 53

FT,

thanks for your very detailed reply.

Shortly after posting i found your thread where you discuss your two indicators. These are really a great help, thanks again for sharing your work here.

I will keep experimenting using your VisualSMA with a period of 1 and the desired period as input for indicators, which should hopefully have the desired effect.


Started this thread Reply With Quote
Thanked by:




Last Updated on September 6, 2012


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts