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)
Difficulty with a relatively basic EMA bar-cross indicator
I'm trying to create a basic EMA bar-cross indicator in EL for use in TradeStation's scanner. The criteria are:
+1 if the price crosses positively over the EMA (Last > EMA > Open)
-1 if the price crosses negatively below the EMA (Open > EMA > Last)
0 otherwise
It's a relatively simple criterion, and in its basic form I can already implement it within the Scanner app. The issue, however, is that the scanner's price parameters (Open, High, Low, Close, etc.) are restricted to a granularity of one day, whereas I want to be able to operate on a timeframe of something like 5 min.
I'm by no means a novice to programming, but I've only had to interact with EasyLanguage a couple of times. I created this indicator which looks correct, but does not work correctly:
Attached is a snippet of the results on a random equity from the Scanner (VXX, 5min). It compiles, but it seems to ignore the positive crosses (where the value should be +1) and it also sustains a value, which it should not do. I've confirmed that the positive crosses do appear within the sample (i.e. it's not just "close"). The magenta line is an EMA with the same period as the indicator should be screening for (55).
Any ideas or suggestions on where I went wrong?
Thanks in advance.
Can you help answer these questions from other members on NexusFi?
welcome to futures.io. Last is a quote field that does not carry any history, but will return the current last price whenever you call it. Try using Close instead.
welcome to futures.io. Last is a quote field that does not carry any history, but will return the current last price whenever you call it. Try using Close instead.
Regards,
ABCTG
Well, I had a feeling it was a stupid mistake - and I was right. I thought I would've tried Close as a quick test, but apparently I didn't.
Now, will this still assert intrabar? That is, if the condition is met at 2.5 minutes into a 5 min candle, will the indicator read 1/-1 prior to the period closing?
Thanks for the help in the right direction. I'm still trying to get the hang of EasyLanguage.
this depends on your indicator settings. If you allow intrabar updates for the indicator in the settings it will.
Regards,
ABCTG
nukespace
Well, I had a feeling it was a stupid mistake - and I was right. I thought I would've tried Close as a quick test, but apparently I didn't.
Now, will this still assert intrabar? That is, if the condition is met at 2.5 minutes into a 5 min candle, will the indicator read 1/-1 prior to the period closing?
Thanks for the help in the right direction. I'm still trying to get the hang of EasyLanguage.