Add audible alert to TRIX indicator


0
0

I came across another user trying to add an alert via the Condition Wizard on Renko charts, and the repsonse was that it’s not possible. I’ve also noticed through my own efforts that it also can’t be done on tick charts. The condition wizard only allows alerts to be set on time charts. Fair enough.

My question is, I am using the built-in TRIX indicator and would simply like an *audible* alert when the signal/average line cross eachother…on the tick chart. I had no issue accomplishing this on the time chart. I’ve tried meshing the original TRIX code with the alert coding that Condition Wizard gave me, but no luck. Any takers? Here’s the original TRIX code:

#

# TD Ameritrade IP Company, Inc. (c) 2007-2019

#

 

declare lower;

 

input length = 9;

input colorNormLength = 14;

input price = close;

input signalLength = 3;

 

def tr = ExpAverage(ExpAverage(ExpAverage(Log(price), length), length), length);

 

plot TRIX = (tr – tr[1]) * 10000;

plot Signal = ExpAverage(TRIX, signalLength);

plot ZeroLine = 0;

 

TRIX.DefineColor(“Highest”, Color.YELLOW);

TRIX.DefineColor(“Lowest”, Color.LIGHT_RED);

TRIX.AssignNormGradientColor(colorNormLength, TRIX.color(“Lowest”), TRIX.color(“Highest”));

Signal.setDefaultColor(GetColor(3));

ZeroLine.SetDefaultColor(GetColor(5));

#END

 

And here’s the code the condition wizard gave me for the time alert:

TRIX(“length” = 15, “color norm length” = 100, “signal length” = 6).”TRIX” crosses TRIX(“length” = 15, “color norm length” = 100, “signal length” = 6).”Signal”

 

 

Love this forum and thank you to all the contributors here! Seriously amazing work.

RESOLVED
Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on January 21, 2020 6:22 pm
29 views
0
Private answer

I don't understand the request. In the first paragraph you acknowledge that Renko and Tick chart aggregations are not supported when building alerts using the Condition Wizard. Then in the second paragraph you are asking for an alert based on tick chart aggregation? From the subject of your question I have to believe this is what you are requesting. This is not supported. The only place you can use Tick aggregation periods are on the charts. Nothing else in the platform currently supports anything but time based aggregation.

Edit: After receiving additional explanation posted in the comment section below I have a solution to the request. I will also be updating the title of the question so that is more clearly describes the context of this request. The original title was "Tick chart alert". The new title will be "Add audible alert to TRIX indicator".

Here are the four lines of code you will add to the bottom of the original code included with the TRIX chart study:

def trixCrossAbove = trix[1] < signal[1] and trix > signal;
def trixCrossBelow = trix[1] > signal[1] and trix < sigal;
Alert(trixCrossAbove, "Trix Cross Above Signal", Alert.BAR, Sound.RING);
Alert(trixCrossBelow, "Trix Cross Below Signal", Alert.BAR, Sound.RING);

Marked as spam
Posted by (Questions: 36, Answers: 2445)
Answered on January 22, 2020 8:23 am
Thanks for such a quick response and sorry for any confusion! My question is: Can an audible alert be added into the original code for the TRIX(or any) indicator? Nevermind the Condition Wizard.
( at January 22, 2020 9:40 am)
Thanks for clarifying your request. I have updated my answer to include the solution you requested. I have also updated the title of the question to reflect the context of your request.
( at January 22, 2020 11:09 am)