Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I’m trying to create a system that uses 2 time frames / data series.
The 1st data series (primary) is 1min.
The 2nd data series is 2min.
The code executes every minute as this is the primary data series (as you would expect) but the problem is the code is excuting every minute on the 2min data series which is causing duplicate values.
You can easily see this by creating a signal with the following code:
print(close data(2):0:5);
This will output duplicate close prices for the 2nd data series. Eg:
1.30785
1.30785
1.30820
1.30820
1.30745
1.30745
How do I get prevent or get rid of the duplicate values?
Can you help answer these questions from other members on NexusFi?
You should post the code, it will be easier to find what's wrong in your logic.
As @TheTrend write it, it's logical to have the same value on the secondary minute bar, you will see 1min close on 50% of the 2min bar.
also, remember that OnBarUpdate() will run for all internally generated multi-series, everytime there is an update and there is a Time&Sales stamp from the exchange. If you want to access 2min data only when it closes then you can change the logic to something like this
if (BarsInProgress == 1 && FirstTickOfBar)
{
// only now access the 2min data, which is the first tick of the next 2min bar that just started forming...
}