Add sound alert to BubbleBuddy indicator


0
0

This is the code for bubblebuddy. I’m trying to get an alert for every time a bubble appears. Attached is what the indicator looks like. Thanks in advance.

declare upper;
input length = {default "2", "3"};
input ChartBubblesON = Yes;
input LinesON = Yes;
plot data;
rec top;
rec bot;
switch (length)
{
case "2":
data= If !ChartBubblesON then Double.NaN else if
Low < Low[1] && Low < Low[-1] && Low < Low[2] && Low < Low[-2] then Low else if High > High[1] && High > High[-1] &&
High > High[2] && High > High[-2]
then High else Double.NaN;
top = if
High > High[1] && High > High[-1] &&
High > High[2] && High > High[-2]
then High else top[1];
bot = if
Low < Low[1] && Low < Low[-1] && Low < Low[2] && Low < Low[-2] then Low else bot[1]; case "3": data = If !ChartBubblesON then Double.NaN else if Low < Low[1] && Low < Low[-1] && Low < Low[2] && Low < Low[-2] && Low < Low[3] && Low < Low[-3] then Low else if High > High[1] && High > High[-1] &&
High > High[2] && High > High[-2] &&
High > High[3] && High > High[-3]
then High else Double.NaN;
top = if
High > High[1] && High > High[-1] &&
High > High[2] && High > High[-2] &&
High > High[3] && High > High[-3]
then High else top[1];
bot = if
Low < Low[1] && Low < Low[-1] &&
Low < Low[2] && Low < Low[-2] &&
Low < Low[3] && Low < Low[-3]
then Low else bot[1];
}
Data.SetPaintingStrategy(PaintingStrategy.points);
Data.SetLineWeight(1);
Data.SetDefaultColor(color.yellow);
Data.HideBubble();
AddChartBubble(1, Data, concat("", data), color.white);
plot topline = if !LinesOn then Double.NaN else top;
topline.SetLineWeight(1);
topline.SetDefaultColor(color.yellow);
topline.SetPaintingStrategy(PaintingStrategy.dashes);
plot bottomline = if !LinesOn then Double.NaN else bot;
bottomline.SetLineWeight(1);
bottomline.SetDefaultColor(color.yellow);
bottomline.SetPaintingStrategy(PaintingStrategy.dashes);
def Sell = TTM_ScalperAlert().PivotLow;
def Buy = TTM_ScalperAlert();
Alert(Sell, "Sell Signal", sound = Sound.Chimes);
Alert(Buy, "Buy Signal", sound = Sound.Chimes);

Attachments:
Marked as spam
Posted by (Questions: 4, Answers: 23)
Asked on October 24, 2017 8:59 pm
448 views
0

Before responding, I need you to confirm this indicator is open-source, free of copy-right claims.

Next:
I will need to fix the title and URL. I need to fix the typo, but more importantly I need to restructure the title so it is clear what you are requesting. This will assist other viewers to search for and find this solution.
The original title “I have a custome alert called bubble buddy and the sound ?”
Will become “Add sound alert to BubbleBuddy indicator”

After these changes are made, the original URL will no longer work. You will need to go to your profile and view the list of your questions in order to find the link to this question.

( at October 25, 2017 7:57 am)
0
I confirm this indicator is open-source, free of copy-right and claims and all the changes you need to make is fine with me. Also how do I even create a profile all I do is log into through facebook then post my question.
( at October 25, 2017 9:57 am)
0

Your profile is automatically created when you login. from the upper left of the screen you will find a menu titled: “User Settings”. The menu contains three items: 1. Profile 2. Questions 3. Log Out
When posting open source code you get from someone else, it is customary to include details showing the original author, or at least a link where you found the code.

( at October 25, 2017 10:13 am)
0

The gentlemen I got it from I no longer have contact with where he got it from not sure but I’ve been adding other codes from different resources this is not the original its been through many changes since I got it a year ago.

( at October 25, 2017 10:24 am)
0

Ok, I’ll post a response to this request later this afternoon, after I fix the title and URL. Thanks for providing those additional details.

( at October 25, 2017 11:54 am)
0

Yes sir your welcome and thank you for your service.

( at October 25, 2017 12:42 pm)
0
Private answer

For some reason when I try to edit this post this site redirects me to a blank page. Just clarify the sound on this indicator does not work not sure if I did something wrong need some assistance if you can.

Marked as spam
Posted by (Questions: 4, Answers: 23)
Answered on October 25, 2017 5:04 am
0
Private answer

When posting code of this length, it is often best to provide the code as an attached txt document. I’m not sure this code can be easily copy/pasted from the website into a Thinkorswim study. So I have attached a txt doc version to this response in case anyone has issues.

Now on to the solution. I see that you have added a few lines to the very bottom.

def Sell = TTM_ScalperAlert().PivotLow;
def Buy = TTM_ScalperAlert();
Alert(Sell, “Sell Signal”, sound = Sound.Chimes);
Alert(Buy, “Buy Signal”, sound = Sound.Chimes);

Just delete those. Completely useless.

The chart bubbles are being generated from the variable named “data”. So if you are going to get any alerts working on this, you will have to use that variable name. The value of “data” is either Double.NaN or a positive numeric value. Double.NaN means “Double Not a Number”. And we can test for this: !IsNaN(data) which means “data is NOT not a number”.

So when !IsNaN(data) returns true, then we know that data is some positive numeric value. Which causes the bubble to appear on the chart at that location. Whenever data == Double.NaN, no bubble is not plotted for that bar.

It is very important you understand what I just explained so that you can grasp the next concept. Notice the indicator has a user adjustable input named: “length”. This controls the number of bars to the left and to the right of the bubble. When set to 2, the code checks two bars behind, then two bars in front to check if the current bar is the highest high or the lowest low. When set to 3, the code checks 3 three bars behind and 3 bars in front.

This means a signal can NEVER be plotted on the current bar of any live chart. In fact it can NEVER be plotted on the second bar back either. The third bar to the left of the last bar on the chart, is when a bubble may be plotted when the length is set to 2. If the length is set to 3, then the soonest you will see a bubble plotted is the fourth bar to the left of the last bar on the chart. I know, you are struggling to get a handle on this. Your next question is Why?

Let’s take a look at a small section of the code used to plot these bubbles:

Low < Low[-2] && Low < Low[3] && Low < Low[-3]

Translated: “The current low is less than the low of two bars into the future AND the current low is less than the low of 3 bars in the past AND the current low is less than the low of 3 bars into the future”

So in order for a bubble to plot, we must be able to read bars in the future. On a live chart, this is impossible to do from the last bar on the far right side of the chart. If we could, we would be rich beyond our wildest dreams.

I already feel like I have gone into far too much detail explaining this. However I see this so many times. Someone finds a slick looking indicator (like the TTM Scalper) and they think to themselves: “If only I could find a way trigger an alert when that thing shows up on the chart”. Not happening. No, it is not possible and stop trying.

Best we can do with this indicator to create alerts you have is to look back 2 or 3 bars into the past to see if a bubble was plotted 2 or 3 bars ago. We look back 2 bars if length is set to 2, and we look back 3 bars if length is set to 3. So we might as well use the length input so that it will adjust when the user changes the settings.

Alert(ChartBubblesON and !IsNaN(data[length]), "Bubble Alert", Alert.BAR, Sound.RING);

Correction: the input named 'length' is a text value and cannot be used as shown above. Please refer to my answer dated 10/26/17 for the corrected code.

So we are checking if bubbles are on and we are checking if data from ‘length’ bars ago is some positive numeric value. Which means a bubble was plotted there.

So if you have fully grasped everything to this point. You have come to realize this indicator is absolutely worthless for trading. Worthless, because we don’t have a time machine and we cannot read bars into the future on a live chart. The TTM Scalper is even worse, read more here: https://www.hahn-tech.com/ans/assignbackgroundcolor-not-working-as-expected/

If you understand this, and it was somewhat of a revelation. You know what I mean by, that palm-to-face sort of ‘ah-hah’ moment…. SHARE this everywhere you can. Spread the word and save others.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 25, 2017 4:24 pm
0

That was a lot to take in I want to show you the strategy it’s used for I don’t rely on this solely I just use the bubbles as as support and resistance it may no be accurate per say but it works well with my 5 min strategy on nadex. Is there away I can send you the strategy so you can maybe make some suggestions or recommendations? I would like to post here once complete.

( at October 25, 2017 7:14 pm)
0

Strategies are a lot of work. They require meticulous attention to detail. I don’t often provide that assistance free of charge in the Q&A forum. You can view our rates and get details on how to submit your project request here: https://www.hahn-tech.com/about/
Just fill out the contact form at the bottom of that page. If the solution takes me less than 15 minutes to complete I will refer the project back to the venue of the Q&A forum.

( at October 25, 2017 7:48 pm)
0

Okay I should have what you need either tomorrow or by Friday. Thanks again

( at October 25, 2017 8:01 pm)
0

For clarification after deleting what you asked and replacing it with
Alert(ChartBubblesON and !IsNaN(data[length]), “Bubble Alert”, Alert.BAR, Sound.RING); there is an Alert settings that If have set up but I still don’t hear the alert no receive a message. Take a look at the attachment.

( at October 25, 2017 9:29 pm)
0

Not able to write an answer so I can attach the pic.

( at October 25, 2017 9:34 pm)
0
Private answer

Sorry about that but in my previous answer I missed the fact that the input named ‘length’ is actually a text value and cannot be used to adjust the Alert condition. So the solution requires the addition of a a variable named ‘index’, added to the original code below rec bot;. The original code is further modified by assigning value to the ‘index’ variable within the switch statement. In plain english, we are using the text value of the ‘length’ input and converting it to a numeric value we can use in the alert condition. So the new alert condition becomes:
Alert(ChartBubblesON and !IsNaN(data[index]), "Bubble Alert", Alert.BAR, Sound.RING);

The full code with the applied fixes is attached as a txt file below this answer. The file name is BubbleBuddy_Alert.txt

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 26, 2017 8:36 am
0
Private answer

Yeah this indicator is useless with sound its still lagging now I see what your saying about seeing into the future. “THUD” upside my head should of drank a V8

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

Yep, be sure to spread this to all your friends to spare them the grief. I see so many folks getting tricked into stuff like this. Unfortunately many of them end up paying for indicators that can’t be traded in a live market.

( at October 26, 2017 12:38 pm)