NexusFi: Find Your Edge


Home Menu

 





Data2 for automated trading


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one Orjan with 3 posts (0 thanks)
    2. looks_two dtrade88 with 2 posts (1 thanks)
    3. looks_3 RM99 with 2 posts (0 thanks)
    4. looks_4 EladLevi with 1 posts (1 thanks)
    1. trending_up 15,488 views
    2. thumb_up 4 thanks given
    3. group 6 followers
    1. forum 12 posts
    2. attach_file 0 attachments




 
Search this Thread
  #11 (permalink)
spkarnati2009
minneapolis MN/USA
 
Posts: 2 since Mar 2016
Thanks Given: 3
Thanks Received: 0

Hello,

Can I automate my trading strategies on Tick or Range charts instead of using Time charts.

Thanks


Reply With Quote
  #12 (permalink)
EladLevi
Tel Aviv, Israel
 
Posts: 2 since Jan 2021
Thanks Given: 0
Thanks Received: 0


Orjan View Post
Thank you ValutaTrader,

I have solved the problem.

Hi There,
I'm facing the same issue BOTH with a data1 as min bar of ES and data2 as daily bars of ES.D
any ideas what I'm doing wrong?

thanks,
E.


Reply With Quote
  #13 (permalink)
 
Fi's Avatar
 Fi 
NexusFi
 


EladLevi View Post
I'm facing the same issue BOTH with a data1 as min bar of ES and data2 as daily bars of ES.D
any ideas what I'm doing wrong?

@EladLevi,

This is a classic EasyLanguage gotcha with recursive functions like XAverage across data series.

The problem: when you call XAverage(Close, Length) of Data2 directly from a strategy applied to Data1, the internal series state of XAverage doesn't always switch context properly to Data2. Since XAverage is recursive (each bar depends on the previous bar's EMA value), this causes incorrect calculations or errors.

The fix is to wrap your XAverage logic inside a custom function, then call that function with "of Data2".

Here's the pattern:

1. Create a new EasyLanguage Function (e.g., "MyEMA"):
  • Inputs: Price(numericseries), Length(numericsimple)
  • MyEMA = XAverage(Price, Length);

2. In your strategy, call it as:
  • Value1 = MyEMA(Close, 20) of Data2;

When you append "of Data2" to your custom function call, EasyLanguage shifts the entire data context for everything inside that function to Data2. All price references, bar counts, and series states resolve correctly against your daily ES.D bars.

A couple of additional things to watch with your ES minute + ES.D daily setup:
  • Data2 values only update when a new daily bar completes, but your strategy evaluates on every Data1 (minute) tick
  • Check your MaxBarsBack settings for Data2 separately -- daily bars need enough history for the EMA to initialize properly
  • Trade orders execute on Data1 by default unless you specify otherwise

This wrapper function approach works for any recursive built-in function across data series, not just XAverage -- keep it in your toolkit.

-- Fi

"The bug isn't in the formula -- it's in which world the formula thinks it lives in."


Learn more about Fi AI trading companion
IMPORTANT: I can make mistakes! Always verify data before relying on it.

Please leave feedback here. You can disable my ability to reply to your posts by placing me on your ignore list.

Fi provides educational information on a best-effort basis only. You are responsible for your own trading decisions and for verification of all data. This message is not trading advice.
Reply With Quote




Last Updated on March 25, 2026


© 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