Do you have a sound alert for MACDHistogram arrows?


0
0

I’m looking  or would like to know how to  create sound alerts for studies with arrows.

RESOLVED
Marked as spam
Posted by (Questions: 4, Answers: 23)
Asked on October 20, 2017 11:38 am
2348 views
0
Private answer

Yes, alerts are very simple to add to any study. For the case you have presented. You will simply copy the code from the built in version of MACD that comes with Thinkorswim. Then add these two lines to the very bottom of that code:

Alert(UpSignal == ZeroLine, "Up Arrow Alert", Alert.BAR, Sound.RING);
Alert(DownSignal == ZeroLine, "Down Arrow Alert", Alert.BAR, Sound.RING);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 20, 2017 11:57 am
0
Private answer

THANK YOU!!!!!!! Does this script apply to any studies with arrows.

Marked as spam
Posted by (Questions: 4, Answers: 23)
Answered on October 20, 2017 10:25 pm
0

I built this based on the MACD that comes with Thinkorswim. I have no idea if it will work with any of the others. But I doubt it.

( at October 21, 2017 9:02 am)
0
Private answer

I’m not sure but its not working I have attached what I am seeing could you check it out.

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 23)
Answered on October 20, 2017 11:06 pm
0

The problem here is that you are not using the full code from the built in study. And I have no idea where you got this section of code from:

MACDHistogram("fast length = 10, "slow length" = 11, "macd length" = 10, "show breakout signals" = Yes)

But that section is creating the error. You need to use the complete code from the standard built in version of MACD that you add to a chart. That indicator has a couple dozen lines of code or more.

( at October 21, 2017 8:59 am)
0
Private answer

Do you have a video tutorial of how to get the code from study I’m a novice at this.

Marked as spam
Posted by (Questions: 4, Answers: 23)
Answered on October 21, 2017 10:36 am
0

Being a novice, I encourage you to watch as many of our vides as you can. You will be up to speed in no time. For an example of how to get code from a study, you can view this video: https://www.hahn-tech.com/thinkorswim-custom-scan-stochastic-macd/

The section you want starts at the 5:10 mark. But be sure to watch the entire video as it will give you a much better understanding of how to work in this environment.

In order to acquire a well rounded knowledge of the main components in Thinkorswim I suggest you check out this post: https://www.hahn-tech.com/ans/where-to-start/

There you will find a series of videos, listed in order of preferred viewing, organized by topic.

( at October 21, 2017 12:43 pm)
0
Private answer

Okay great I will watch the videos thanks Pete.

Marked as spam
Posted by (Questions: 4, Answers: 23)
Answered on October 21, 2017 5:58 pm
0
Private answer

This the new error I’m getting.

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 23)
Answered on October 21, 2017 6:40 pm
0

Nope, you still don’t have the full code. You see you only have line numbers 11, 12 and 13 in that screenshot? Why are you not showing lines 1 through 10 in your screenshot? How can I see what you are doing wrong? If you were using the FULL CODE, you would have at least 42 lines of code. Where on earth are you getting your code? If you don’t show it, I cannot help.

( at October 21, 2017 7:27 pm)
0

I see what your saying but my issue was not with the whole code just the zeroline was showing red but its all good learned something new. Thanks

( at October 22, 2017 3:15 am)
0

Yes, the ZeroLine was showing red. The error message listed below it, indicates that the WHOLE CODE is missing the ZeroLine variable. That is why we need to see EVERYTHING. Please, if you truly want to learn this, make sure you show everything on the screen.

( at October 22, 2017 8:00 am)
0

Yes sir will do thanks again.

( at October 22, 2017 9:49 am)
0
Private answer

Ok, after several failed attempts at assisting Carlos with the full implementation of this solution I decided it was time to post the full code myself. Here it is, straight from the MACD study in Thinkorswim, with only my two lines added to implement the alerts:

#
# TD Ameritrade IP Company, Inc. (c) 2007-2017
#
declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;
plot Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Alert(UpSignal == ZeroLine, "Up Arrow Alert", Alert.BAR, Sound.RING);
Alert(DownSignal == ZeroLine, "Down Arrow Alert", Alert.BAR, Sound.RING);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 21, 2017 7:30 pm
0

Is there any way to test this prior to the opening of the forex market?

( at October 22, 2017 9:51 am)
0

Thinkorswim has a replay feature called OnDemand. The button is easily visible at the top of the main screen. Once you click that button it starts replaying historical data. When the replay starts, you will find a date/time display showing the current date and time being replayed. Click on that, to change the date and time to your preference.

( at October 22, 2017 10:14 am)
0
this is awesome stuff thank you. i added your full code plus your alert lines. Now how do I set that MACD alert on think or swim for a specific stock? and how do I make it that I also get the alert as a notification on my phone from the thinkorswim app? again thank you
( at January 6, 2020 8:38 am)
0
This will only work as a Chart Study. In order to get sms/email notifications you will have to reconfigure the code to work with a tool called Study Alert or Scan. However for a basic signal like this you can build that using the Condition Wizard: https://www.hahn-tech.com/thinkorswim-condition-wizard/
( at January 6, 2020 2:31 pm)