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,090 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

(login for full post details)
  #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?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
Trader Dale [email protected] or Scammer Dale
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Tao te Trade: way of the WLD
30 thanks
Supertradersams Thread Journal on NQ/MNQ
25 thanks
Deaddogs Stock Trading
23 thanks
GFIs1 1 DAX trade per day journal
22 thanks
Daytrading ES & NQ
13 thanks

(login for full post details)
  #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
(login for full post details)
  #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
(login for full post details)
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,761 since Jun 2009
Thanks Given: 3,823
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
(login for full post details)
  #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
(login for full post details)
  #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
(login for full post details)
  #8 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,761 since Jun 2009
Thanks Given: 3,823
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