Welcome to NexusFi: the best trading community on the planet, with over 200,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 -- discounts are available after registering.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
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"):
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."
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.