Alert on Daily EMA cross Instead of Intraday


I have a very simple strategy where I enter the trade when Exponential Moving Average of 13 day crosses over 48 days. I have previously setup the alert with study “MovAvgExponential” crosses “MovAvgExponential”, but I seems to get alert whenever there is crossover throughout the day – whereas my intention is to have alert on daily interval (closing price), no matter how many time they cross intraday.

The setup of mine as in attached: I have the reverse alert setup, so I got so many alerts intraday if these crosses. I’m interested to find out how to set to daily alert instead of intraday with the EMA study.

Alternatively if you know other similar studies alert that achieve the same purpose that’d be of great help too! I noticed there is also a “MovingAvgCrossover” study, of which until now I do not know if there is any differences with my prior study set up.

Marked as spam
Posted by (Questions: 4, Answers: 3)
Asked on August 9, 2018 7:18 am
Private answer

Ok, that first screenshot shows a Price Alert. That is not a Study Alert. No wonder you are not getting results as expected. The only way to explain this is to show you step-by-step through a series of screenshots. Included below.

We have several examples just like this scattered throughout the Q&A forum. However this is the most detailed explanation by far. Perhaps you viewed some of our previous posts and didn’t realize the difference between a Price Alert and a Study Alert. Hope this puts you on the right path.

Marked as spam
Posted by (Questions: 37, Answers: 3976)
Answered on August 9, 2018 7:45 am

Hi Pete, I have configured as according to your instructions. Recently one of my stocks under watch list triggered the EMA, however it still trigger intraday. Any advice what could have gone wrong, or any adjustment required?

Screenshot below, I am located in Singapore so the time zone is different.

( at August 28, 2018 7:26 am)

Those are Study Alerts based on the Daily time frame being triggered during the corse of the trading session. It is common for signals on a live daily bar to appear and disappear from the chart many times during the course of the day. This is totally normal.

To make this even more clear. Look at that daily chart of DHR. Notice how choppy that price action is. Also notice the height of that candle which triggered the crossover. All those alerts are valid, so long as you have the Study Alert set to regenerate after each time it is triggered.

So, intraday signals, based on a daily time frame. Totally legitimate. You can set there and watch the chart and see it happening for yourself. Using OnDemand feature.

The only way to prevent this, is to add “within 1 bars” to the end of your code. But you should be aware this will cause the code to look for the signal at the previous bar, and not the current daily bar. The study alert will trigger only once per day, at the market open.

( at August 28, 2018 7:43 am)

Thanks Pete, your latter description is what I am looking for, regardless of intraday movement. However following the above instructions, the ‘within 1 bar’ has already been set on this step

Or I have to edit (adding within 1 bar) manually in the thinkscript editor?

( at August 29, 2018 6:50 am)

Yes, you must manually edit the script produced by the Condition Wizard. The Condition Wizard produces this:

MovingAvgCrossover(“length1” = 13, “length2” = 48, “average type1” = “EXPONENTIAL”, “average type2” = “EXPONENTIAL”)

Which needs to be modified to this:

MovingAvgCrossover(“length1” = 13, “length2” = 48, “average type1” = “EXPONENTIAL”, “average type2” = “EXPONENTIAL”) is true within 1 bars

( at August 29, 2018 10:46 am)

Hi Pete, I have followed your modification by adding ‘within 1 bars’ as seen here however just today NFLX was triggered, and I’m still receiving multiple alerts intraday (I have the reverse trigger setup)

I am not quite sure which part of the script went wrong.. are you able to advice?

( at August 31, 2018 7:07 am)

Sorry, I had one tiny detail that was not correct. This is the line of code that shifts the crossover signals one bar to the right:

MovingAvgCrossover(“length1” = 13, “length2” = 48, “average type1” = “EXPONENTIAL”, “average type2” = “EXPONENTIAL”) from 1 bars ago is true

( at August 31, 2018 7:40 am)