Proper way to use TL_SetAlert:  [SOLVED]

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Proper way to use TL_SetAlert:

Postby arjfca » 08 May 2017

Hello

The goal is to trigger an alert if price cross a given trendline. The indicator alert is set to Enable.
What should be expected when price cross a trendline that has an alert set to it?

Martin

The TL_alert is set when a trendline has been set with style = 2

Code: Select all

ActualStyle = TL_GetStyle(Active_TL);

If ActualStyle = 1 then begin
TL_SetStyle(Active_TL, 2);
TL_SetAlert(Active_Tl,1);
end
else
TL_SetStyle(Active_TL,1);
TL_SetAlert(Active_TL,0);
end;

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Proper way to use TL_SetAlert:

Postby TJ » 08 May 2017

Hello

The goal is to trigger an alert if price cross a given trendline. The indicator alert is set to Enable.
What should be expected when price cross a trendline that has an alert set to it?

Martin

The TL_alert is set when a trendline has been set with style = 2

Code: Select all

ActualStyle = TL_GetStyle(Active_TL);

If ActualStyle = 1 then begin
TL_SetStyle(Active_TL, 2);
TL_SetAlert(Active_Tl,1);
end
else
TL_SetStyle(Active_TL,1);
TL_SetAlert(Active_TL,0);
end;


Which part of wiki do you need help on?

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Proper way to use TL_SetAlert:

Postby arjfca » 08 May 2017

Hello TJ

WIKI:
TL_SetAlert(TL_ID, AlertStatus)

TL_ID - a numerical expression specifying the trendline ID number.
AlertStatus - a numerical expression specifying the alert status for the trendline:
0 - Alert disabled.
1 - Breakout intra-bar.
Alert triggering conditions are evaluated intra-bar.
An alert is triggered if the High crosses over the trendline or the Low crosses under the trendline.
2 - Breakout on close.
Alert triggering conditions are evaluated at Close of a bar.
An alert is triggered if the Close of the previous bar was below the trendline and the Close of the current bar is above the trendline, or if the Close of the previous bar was above the trendline and the Close of the current bar is below the trendline.
I did set the alert to (1) for an intra-bar brake-out. The indicator alarm is set to enable.

My understanding is that I should get an alert popup when price do cross a trendline that has the alert set on it

Martin

User avatar
TJ
Posts: 7743
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2222 times

Re: Proper way to use TL_SetAlert:

Postby TJ » 08 May 2017

Hello TJ

WIKI:
TL_SetAlert(TL_ID, AlertStatus)

TL_ID - a numerical expression specifying the trendline ID number.
AlertStatus - a numerical expression specifying the alert status for the trendline:
0 - Alert disabled.
1 - Breakout intra-bar.
Alert triggering conditions are evaluated intra-bar.
An alert is triggered if the High crosses over the trendline or the Low crosses under the trendline.
2 - Breakout on close.
Alert triggering conditions are evaluated at Close of a bar.
An alert is triggered if the Close of the previous bar was below the trendline and the Close of the current bar is above the trendline, or if the Close of the previous bar was above the trendline and the Close of the current bar is below the trendline.
I did set the alert to (1) for an intra-bar brake-out. The indicator alarm is set to enable.

My understanding is that I should get an alert popup when price do cross a trendline that has the alert set on it

Martin

This is NOT the indicator alert.

This is a TL alert.

The TL will give an alarm. No popup is promised.

arjfca
Posts: 1292
Joined: 23 Nov 2010
Has thanked: 725 times
Been thanked: 223 times

Re: Proper way to use TL_SetAlert:  [SOLVED]

Postby arjfca » 08 May 2017

HA! OK

So I suppose that I should read back the TL_GetAlert (TLNumber) and see if it has been triggered

Will work on that later

Martin


Return to “MultiCharts”