Alerts Question

Questions about MultiCharts and user contributed studies.
LTG
Posts: 30
Joined: 08 Sep 2009

Alerts Question

Postby LTG » 01 Jul 2010

I'm looking for a bit of assistance in trying to add an alert to the below code. Its a fast MA which changes colour when up or down. I'm trying to get the indicator to fire an alert when that colour change occurs.

So far, all i've been able to get are constant alerts up or down, not the change in colour. I tried referencing one of the existing indicators within MC that have alerts but the relevant ones all involve the crossing of a line.

Thx in advance for the assistance.

Inputs:

price(Close),
length(13),
upColour(black),
downColour(white);

Value1 = jtHMA(price, length);

Plot1(Value1, "FastMA");

{ Color criteria }
if (Value1 > Value1[1]) then
SetPlotColor(1, upColour)
else if (Value1 < Value1[1]) then
SetPlotColor(1, downColour);
alert;
Attachments
example.gif
example.gif (168.97 KiB) Viewed 108 times

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 485 times

Postby Dave Masalov » 14 Jul 2010

Dear LTG,

In the code that you have posted the alert has no condition. Please use "begin" and "end" keywords. For more information, please read the Help on "If" keyword.

Here is the example:

Code: Select all

{ Color criteria }
if (Value1 > Value1[1]) then
Begin
    SetPlotColor(1, upColour);
    alert;
End
else if (Value1 < Value1[1]) then
Begin
    SetPlotColor(1, downColour);
    alert;
End;



Return to “MultiCharts”