NexusFi: Find Your Edge


Home Menu

 





2nd Data Series Problem


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one sam028 with 2 posts (0 thanks)
    2. looks_two nismo with 2 posts (0 thanks)
    3. looks_3 TheTrend with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,110 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 7 posts
    2. attach_file 0 attachments




 
Search this Thread

2nd Data Series Problem

  #1 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3

Hi All,

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?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Futures True Range Report
The Elite Circle
Deepmoney LLM
Elite Quantitative GenAI/LLM
Exit Strategy
NinjaTrader
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
 
  #3 (permalink)
 TheTrend 
Paris, France
 
Experience: Advanced
Platform: Amibroker
Trading: Futures, Stocks
Posts: 95 since Jun 2011
Thanks Given: 118
Thanks Received: 105


This is absolutely normal since your print function will be executed at the end of every 1min bar.

However, you can build your signals with Data2.

Maybe we can help you if you give us more information about what you need to do more precisely.

Reply With Quote
  #4 (permalink)
nismo
Australia
 
Posts: 32 since Dec 2010
Thanks Given: 7
Thanks Received: 3

What do you mean you can build your systems with data2?

I want my system to primarily use data1 and then for one bit I want to use data2.

I want to do a calculation using the last 3 closing prices of data2.

Reply With Quote
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629

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.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #6 (permalink)
 TheTrend 
Paris, France
 
Experience: Advanced
Platform: Amibroker
Trading: Futures, Stocks
Posts: 95 since Jun 2011
Thanks Given: 118
Thanks Received: 105


nismo View Post
What do you mean you can build your systems with data2?

I want my system to primarily use data1 and then for one bit I want to use data2.

I want to do a calculation using the last 3 closing prices of data2.

Then you can use a code like that:

 
Code
if close of data2 > (close[1] of data2 + close[2] of data2 + close[3] of data2 )/3 
then buy 1 contract next bar market;
Hope that helps.

Reply With Quote
  #7 (permalink)
 buylosellhi 
new york
 
Experience: None
Platform: SierraChart
Posts: 77 since Dec 2010
Thanks Given: 4
Thanks Received: 44

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...
}

hope this helps...

Reply With Quote
  #8 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


buylosellhi View Post
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...
}

hope this helps...

This is for MultiCharts, no OnBarUpdate() .

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote




Last Updated on September 8, 2011


© 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