#### evolernet

##### New member
Good afternoon everyone
help to add a sound notification when arrows appear on the chart.

# TD Ameritrade IP Company, Inc. (c) 2013-2015 гг.
#

entry priceH = high;
entry price L = low;
input percentage Reversal = 5.0;
input absolute reversal = 0.0;
enter atrLength = 5;
input atrReversal = 1.5;

def zigZag = link ZigZagHighLow(priceH, priceL, reversal percentage, absolute reversal, atrLength, atrReversal).ZZ;

def step1 = open[1] >= open и open >= close[1] and open[1] > close[1];
def step2 = open[1] <= open и open <= close[1] and open[1] < close[1];

def upStep1 = step1 and close > open[1];
def upStep2 = step2 and close > close[1];
def downStep1 = step1 и close < close[1];
def downStep2 = step2 and close < open[1];

graph UpStep = (upStep1 or upStep1[-1] or upStep2 or upStep2[-1]) and zigZag == low;
plot DownStep = (downStep1 or downStep1[-1] or downStep2 or downStep2[-1]) and zigZag == high;

UpStep.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UpStep.SetDefaultColor(GetColor(0));
UpStep.SetLineWeight(2);
DownStep.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
DownStep.SetDefaultColor(GetColor(1));
DownStep.SetLineWeight(2);

# @ evolernet
# your code had a little bit of syntax challenges off so I modified it a little bit for you and added Alerts. Untested but it appears as if it will work better on the aggregations of day or higher

# TD Ameritrade IP Company, Inc. (c) 2013-2015 гг.
#

def entryPriceH = high;
def entryPriceL = low;
input percentageReversal = 5.0;
input absoluteReversal = 0.0;
input atrLength = 5;
input atrReversal = 1.5;

def zigZag = Reference ZigZagHighLow(entryPriceH, entryPriceL, percentageReversal, absoluteReversal, atrLength, atrReversal).ZZ;

def step1 = open[1] >= open or open >= close[1] and open[1] > close[1];
def step2 = open[1] <= open or open <= close[1] and open[1] < close[1];

def upStep1 = step1 and close > open[1];
def upStep2 = step2 and close > close[1];
def downStep1 = step1 or close < close[1];
def downStep2 = step2 and close < open[1];

plot UpStep = (upStep1 or upStep1[-1] or upStep2 or upStep2[-1]) and zigZag == low;
plot DownStep = (downStep1 or downStep1[-1] or downStep2 or downStep2[-1]) and zigZag == high;

UpStep.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UpStep.SetDefaultColor(GetColor(0));
UpStep.SetLineWeight(2);
DownStep.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
DownStep.SetDefaultColor(GetColor(1));
DownStep.SetLineWeight(2);

thanks for the help...i checked, the arrow appears but no signal...

I have the same issue, I can create an arrow indicator but not an alert

Last edited:
The above code waits until a future bar[-1] and then goes back and paints the signal on the previous bar.
I have not seen an alert that could fire on the repainting of a previous bar.
Alerts 'generally' work on the current bar.

The above code waits until a future bar[-1] and then goes back and paints the signal on the previous bar.

The code I'm using below does not look into the future but does not generate an alert

Ruby:
``````def upIndicator = vClose < test;
plot upIndicatorp = if upIndicator then open[-1] else nan;
upIndicatorp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upIndicatorp.AssignValueColor(Color.GREEN);
upIndicatorp.SetLineWeight(1);

The code I'm using below does not look into the future but does not generate an alert
def upIndicator = vClose < test;
plot upIndicatorp = if upIndicator then open[-1] else nan;
upIndicatorp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upIndicatorp.AssignValueColor(Color.GREEN);
upIndicatorp.SetLineWeight(1);

On the ToS platform, a negative number in a bracket, refers to that many numbers of bars into the future.
Your code states after the signal happened, wait until the open of the next candle to plot the arrow.
This is not a bad idea. It prevents alerts from occurring during the formation of the candle.

Here is an idea:
This should get an alert back to the previous bar.

Last edited:
My two cents. You may need to add:
or

Also this example:

From Ken Hahn
or
From TOS Indicators

Study setting should look like these:

Some of this should be helpful.
KevinCounts

Looking for this upgrade also , would be nice if you dose off a lot watching a screen all day ?

can anyone put together the whole indicator with sound signals? thanks in advance

87k+ Posts
406 Online

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?