NexusFi: Find Your Edge

Home Menu


Multiple timeframes and max number of bars

Discussion in EasyLanguage Programming

      Top Posters
    1. looks_one Quick Summary with 1 posts (0 thanks)
    2. looks_two The9000 with 1 posts (1 thanks)
    3. looks_3 ABCTG with 1 posts (1 thanks)
    4. looks_4 TraderWalrus with 1 posts (0 thanks)
    1. trending_up 1,751 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments

Search this Thread

Multiple timeframes and max number of bars

  #1 (permalink)
Bangkok Thailand
Posts: 36 since May 2016
Thanks Given: 15
Thanks Received: 17

I use 1-minute interval as data1, 1 day interval as data2. Same instrument (USD.JPY in this case)

I need to access 2,000 bars back for code involving the 1 minute interval. I the 1 day interval to analyze the last 15 bar.

I get the error "Not enough series length" when I specify 2,000 as "maximum number of bars study will reference", unless I load 2,000 days of data. This is even for a trivial strategy that includes only the following code:

print ("d1",close of data1);
print ("d2",close of data2);

I don't need 2,000 days of data before the backtest period starts, is there a way to specify different "bars back" for the different intervals?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Platforms and Indicators
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
Increase in trading performance by 75%
The Elite Circle
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
29 thanks
Tao te Trade: way of the WLD
24 thanks
Diary of a simple price action trader
21 thanks
My NQ Trading Journal
14 thanks
HumbleTraders next chapter
10 thanks
  #3 (permalink)
 ABCTG   is a Vendor
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


not that I am aware off, I am afraid MC requires the max bars back setting for all dataseries.
You could try to work around that by computing your higher timeframe out of the lower timeframe and not load a Data2 or by making the second dataseries available from a different chart using external DLLs.



Follow me on Twitter Reply With Quote
Thanked by:
  #4 (permalink)
Chicago, IL
Posts: 6 since Oct 2015
Thanks Given: 0
Thanks Received: 3

As an alternative to using the daily data as data2, you can eliminate data2 and build an array from your 1 minute bars using the closed(x), opend(x), highd(x), lowd(x), etc functions. This will eliminate the need to load 2000 days back of bars and also saves the need to have Data2 in your data feed.

I can do something like:



if currentsession(1) <> current session(1)[1] then begin

for x = 100 downto 2
ClosedDay[x] = ClosedDay[x-1]
OpenDay[x] = ClosedDay[x-1]

ClosedDay[1] = closed(1)
OpenDay[1] = opend(1)

Now all of the daily data is contained in the array 100 days back, or 15 in your case. Easy Language has a battery of array functions that allow you to perform many of the common functions on arrays such as:

MvgAvg = AveragrArray(ClosedDay, 30);

Reply With Quote
Thanked by:

Last Updated on October 30, 2016

© 2024 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 - Privacy Policy - Downloads - Top
no new posts