"trendline break alert" help needed

#1
I want to make a sound alert when a trend line is broken.
I have made a small afl by studying amibroker help file but it dose not seems to work.
I am not able to figure it out what is wrong.
This afl should play a sound alert when a support "SU" or resistance "RE" line drawn on charts are broken by closing price


////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


_SECTION_END();

_SECTION_BEGIN("Sound alarm on Trendline Break ");
////////////////////////////// Sound alarm on Trendline Break /////////////////////////////////////

BuySignal = Cross( Close, Study( "SU", GetChartID() ) );
SellSignal = Cross( Study( "SU", GetChartID() ), Close );
ShortSignal = Cross( Study( "RE", GetChartID() ), Close );
CoverSignal = Cross( Close, Study( "RE", GetChartID() ) );
//AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" + SheetNum, 1, 1+2+4+8, 20 ); //syntax for buy //signal

AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 1, 1+2, 10000 ); //Buy
AlertIf( SellSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 2, 1+2, 10000 ); //Sell
AlertIf( ShortSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 3, 1+2, 10000 ); //Short
AlertIf( Coversignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 4, 1+2, 10000 ); //Cover
/////////////////////////////////////////////////////////////////////////////
_SECTION_END();
////////////////////////////////////////////////////////////////////////////



Your help is appreciated very much.
Regards
 
Last edited:
#2
I want to make a sound alert when a trend line is broken.
i have coded small afl by studying amibroker help file but it dose not seems to work. I am not able to figure it out what am I doing wrong.
Your help is appreciated very much.
Regards

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


_SECTION_END();

_SECTION_BEGIN("Sound alarm on Trendline Break ");
////////////////////////////// Sound alarm on Trendline Break /////////////////////////////////////

BuySignal = Cross( Close, Study( "SU", 1361 ) );
SellSignal = Cross( Study( "SU", 1361 ), Close );
ShortSignal = Cross( Study( "RE", 1361 ), Close );
CoverSignal = Cross( Close, Study( "RE", 1361 ) );
/*AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" + SheetNum, 1, 1+2+4+8, 20 ); //Buy
*/
AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" , 1, 1+2, 10000 ); //Buy
AlertIf( SellSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" , 2, 1+2, 10000 ); //Sell
AlertIf( ShortSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" , 3, 1+2, 10000 ); //Short
AlertIf( Coversignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" , 4, 1+2, 10000 ); //Cover
/////////////////////////////////////////////////////////////////////////////
_SECTION_END();
Please change ding.wav file with some other sound file from the same media folder.
I played this file and the sound is not audible.
 
#3
Please change ding.wav file with some other sound file from the same media folder.
I played this file and the sound is not audible.
Yes that's what the problem is

first you have to draw two trend lines manually on the chart and name there study id to "SU"(for Support line) and "RE" (for resistance) by right clicking on the trend line and then selecting it on properties tab in dropdown menu

i have tried this but its not playing alert sound on trendline cross

if anybody can help please come forward
 
#4
_SECTION_BEGIN("Supply Demand");
SetChartOptions(0, chartShowArrows | chartShowDates);
SetChartBkColor(ParamColor("Outer Panel", colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart", colorDarkGrey), ParamColor("Lower Chart", colorDarkGrey));
GraphXSpace = Param("GraphXSpace", 10, 0, 100, 1);

colorHighliter = IIf(C >= O, ColorRGB(0, 128, 0), ColorRGB(128, 0, 0));

//Demand Point
colorDemandPoint = ParamColor("Demand Line", ColorRGB(0, 128, 255));
DemandPoint = (Ref(L, -1) < Ref(L, -2)) & (L < Ref(L, -1)) & (L < Ref(L, 1)) & (Ref(L, 1) < Ref(L, 2));

//Supply Point
colorSupplyPoint = ParamColor("Supply Line", ColorRGB(255, 128, 0));
SupplyPoint = (Ref(H, -1) > Ref(H, -2)) & (H > Ref(H, -1)) & (H > Ref(H, 1)) & (Ref(H, 1) > Ref(H, 2));

CountTrendBars = 0;
//CurrentBar = BarCount - 1;
dx0 = dx1 = dy0 = dy1 = 0;
sx0 = sx1 = sy0 = sy1 = 0;


//-- Modified by KelvinHand -----------
function VisiBarsPerChart()
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
return Min(lvb-fvb,BarCount-fvb);
}


nBars=1.5*VisiBarsPerChart();
if (nBars <BarCount)
iLimit = (BarCount-1) - nBars;
else
iLimit = 0;

//------------------------------------


for (i = BarCount-1; i>iLimit; i--) {
if (DemandPoint) {
if (dx1 == 0 & dy1 == 0) {
dx1 = i;
dy1 = L;
} else {
dx0 = i;
dy0 = L;
}
if (dx0 != 0 & dx1 != 0 & dy0 != 0 & dy1 != 0) {
if (dy0 < dy1) {
a = (-dy0 + dy1) / (-dx0 + dx1);
b = dy0 - dx0 * a;
for (j = dx1; j < BarCount; j++) {
if (j != dx1) {
y2 = a * j + b;
if (C[j] < y2) {
dy1 = y2;
dx1 = j;
colorHighliter[j] = ColorRGB(128, 0, 128);
CountTrendBars[j] = dx1 - dx0 - 1;
break;
}
}
}
if (dy1 != y2) {
dy1 = y2;
dx1 = BarCount - 1;
}
Plot(LineArray(dx0, dy0, dx1, dy1, 0), "", colorDemandPoint, styleThick);
}
dx1 = dx0;
dy1 = dy0;
dx0 = dy0 = 0;
}
}
if (SupplyPoint) {
if (sx1 == 0 & sy1 == 0) {
sx1 = i;
sy1 = H;
} else {
sx0 = i;
sy0 = H;
}
if (sx0 != 0 & sx1 != 0 & sy0 != 0 & sy1 != 0) {
if (sy0 > sy1) {
a = (-sy0 + sy1) / (-sx0 + sx1);
b = sy0 - sx0 * a;
for (j = sx1; j < BarCount; j++) {
if (j != sx1) {
y2 = a * j + b;
if (C[j] > y2) {
sy1 = y2;
sx1 = j;
colorHighliter[j] = ColorRGB(128, 128, 0);
CountTrendBars[j] = sx1 - sx0 - 1;
break;
}
}
}
if (sy1 != y2) {
sy1 = y2;
sx1 = BarCount - 1;
}
Plot(LineArray(sx0, sy0, sx1, sy1, 0), "", colorSupplyPoint, styleThick);

}
sx1 = sx0;
sy1 = sy0;
sx0 = sy0 = 0;
}
}
}

//Stop Loss & Targets
for (i = BarCount-1; i>iLimit; i--) {
if (colorHighliter == ColorRGB(128, 0, 128)) {
StopLoss = 0;
for (j = i - CountTrendBars; j <= i; j++) {
StopLoss = Max(H[j], StopLoss);
}
if (i - (BarCount - 1) != 0) {
t1 = C - (StopLoss - C);
t2 = C - ((StopLoss - C) * 1.272);
t3 = C - ((StopLoss - C) * 1.618);
Plot(LineArray(i, StopLoss + 0.01, BarCount - 1, StopLoss + 0.01, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, C, BarCount - 1, C, 0), "", colorYellow, styleDots);
Plot(LineArray(i, t1, BarCount - 1, t1, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, t2, BarCount - 1, t2, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, t3, BarCount - 1, t3, 0), "", colorRed, styleDots | styleNoLabel);
PlotText("Stop Loss\[email protected]" + WriteVal(StopLoss + 0.01, 1.2), BarCount, StopLoss + 0.01, colorWhite);
PlotText("T1 @" + WriteVal(t1, 1.2), BarCount, t1, colorWhite);
PlotText("T2 @" + WriteVal(t2, 1.2), BarCount, t2, colorWhite);
PlotText("T3 @" + WriteVal(t3, 1.2), BarCount, t3, colorWhite);
}
break;
}
if (colorHighliter == ColorRGB(128, 128, 0)) {
StopLoss = 9999;
for (j = i - CountTrendBars; j <= i; j++) {
StopLoss = Min(L[j], StopLoss);
}
if (i - (BarCount - 1) != 0) {
t1 = C + (C - StopLoss);
t2 = C + ((C - StopLoss) * 1.272);
t3 = C + ((C - StopLoss) * 1.618);
Plot(LineArray(i, StopLoss - 0.01, BarCount - 1, StopLoss - 0.01, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, C, BarCount - 1, C, 0), "", colorYellow, styleDots);
Plot(LineArray(i, t1, BarCount - 1, t1, 0), "", colorBrightGreen, styleDots | styleNoLabel);
Plot(LineArray(i, t2, BarCount - 1, t2, 0), "", colorBrightGreen, styleDots | styleNoLabel);
Plot(LineArray(i, t3, BarCount - 1, t3, 0), "", colorBrightGreen, styleDots | styleNoLabel);
PlotText("Stop Loss\[email protected]" + WriteVal(StopLoss - 0.01, 1.2), BarCount, StopLoss - 0.01, colorWhite);
PlotText("T1 @" + WriteVal(t1, 1.2), BarCount, t1, colorWhite);
PlotText("T2 @" + WriteVal(t2, 1.2), BarCount, t2, colorWhite);
PlotText("T3 @" + WriteVal(t3, 1.2), BarCount, t3, colorWhite);
}
break;
}
}

//Price
SetBarFillColor(colorHighliter);
Plot(C, "Close", IIf(colorHighliter == ColorRGB(128, 0, 128), ColorRGB(255, 0, 255), IIf(colorHighliter == ColorRGB(128, 128, 0), colorYellow, IIf(C > O, colorBrightGreen, IIf(C < O, colorRed, colorWhite)))), styleCandle);

//Volume
/*colorVolume = ParamColor("Volume Area", ColorRGB(0, 0, 0));
Plot(Volume, "", colorVolume, styleArea | styleOwnScale | styleNoLabel, Null, Null, 0, 0, 1);*/

Title = Name() + " - {{INTERVAL}} - {{DATE}} - Open = " + NumToStr(O, 1.2) + ", High = " + NumToStr(H, 1.2) + ", Low = " + NumToStr(L, 1.2) + ", Close = " + NumToStr(C, 1.2) + " (" + WriteVal(ROC(C, 1), 1.2) + "%)"; /*, Volume = " + WriteVal(Volume, 1.2);*/
_SECTION_END();

Use this afl.
Here you dont need to manually draw trendlines and once trendline is broken it gives targets and stoploss also.
 
#5
_SECTION_BEGIN("Supply Demand");
SetChartOptions(0, chartShowArrows | chartShowDates);
SetChartBkColor(ParamColor("Outer Panel", colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart", colorDarkGrey), ParamColor("Lower Chart", colorDarkGrey));
GraphXSpace = Param("GraphXSpace", 10, 0, 100, 1);

colorHighliter = IIf(C >= O, ColorRGB(0, 128, 0), ColorRGB(128, 0, 0));

//Demand Point
colorDemandPoint = ParamColor("Demand Line", ColorRGB(0, 128, 255));
DemandPoint = (Ref(L, -1) < Ref(L, -2)) & (L < Ref(L, -1)) & (L < Ref(L, 1)) & (Ref(L, 1) < Ref(L, 2));

//Supply Point
colorSupplyPoint = ParamColor("Supply Line", ColorRGB(255, 128, 0));

SupplyPoint = (Ref(H, -1) > Ref(H, -2)) & (H > Ref(H, -1)) & (H > Ref(H, 1)) & (Ref(H, 1) > Ref(H, 2));

CountTrendBars = 0;
//CurrentBar = BarCount - 1;
dx0 = dx1 = dy0 = dy1 = 0;
sx0 = sx1 = sy0 = sy1 = 0;


//-- Modified by KelvinHand -----------
function VisiBarsPerChart()
{
lvb=Status("lastvisiblebar");
fvb=Status("firstvisiblebar");
return Min(lvb-fvb,BarCount-fvb);
}


nBars=1.5*VisiBarsPerChart();
if (nBars <BarCount)
iLimit = (BarCount-1) - nBars;
else
iLimit = 0;

//------------------------------------


for (i = BarCount-1; i>iLimit; i--) {
if (DemandPoint) {
if (dx1 == 0 & dy1 == 0) {
dx1 = i;
dy1 = L;
} else {
dx0 = i;
dy0 = L;
}
if (dx0 != 0 & dx1 != 0 & dy0 != 0 & dy1 != 0) {
if (dy0 < dy1) {
a = (-dy0 + dy1) / (-dx0 + dx1);
b = dy0 - dx0 * a;
for (j = dx1; j < BarCount; j++) {
if (j != dx1) {
y2 = a * j + b;
if (C[j] < y2) {
dy1 = y2;
dx1 = j;
colorHighliter[j] = ColorRGB(128, 0, 128);
CountTrendBars[j] = dx1 - dx0 - 1;
break;
}
}
}
if (dy1 != y2) {
dy1 = y2;
dx1 = BarCount - 1;
}
Plot(LineArray(dx0, dy0, dx1, dy1, 0), "", colorDemandPoint, styleThick);
}
dx1 = dx0;
dy1 = dy0;
dx0 = dy0 = 0;
}
}
if (SupplyPoint) {
if (sx1 == 0 & sy1 == 0) {
sx1 = i;
sy1 = H;
} else {
sx0 = i;
sy0 = H;
}
if (sx0 != 0 & sx1 != 0 & sy0 != 0 & sy1 != 0) {
if (sy0 > sy1) {
a = (-sy0 + sy1) / (-sx0 + sx1);
b = sy0 - sx0 * a;
for (j = sx1; j < BarCount; j++) {
if (j != sx1) {
y2 = a * j + b;
if (C[j] > y2) {
sy1 = y2;
sx1 = j;
colorHighliter[j] = ColorRGB(128, 128, 0);
CountTrendBars[j] = sx1 - sx0 - 1;
break;
}
}
}
if (sy1 != y2) {
sy1 = y2;
sx1 = BarCount - 1;
}
Plot(LineArray(sx0, sy0, sx1, sy1, 0), "", colorSupplyPoint, styleThick);

}
sx1 = sx0;
sy1 = sy0;
sx0 = sy0 = 0;
}
}
}

//Stop Loss & Targets
for (i = BarCount-1; i>iLimit; i--) {
if (colorHighliter == ColorRGB(128, 0, 128)) {
StopLoss = 0;
for (j = i - CountTrendBars; j <= i; j++) {
StopLoss = Max(H[j], StopLoss);
}
if (i - (BarCount - 1) != 0) {
t1 = C - (StopLoss - C);
t2 = C - ((StopLoss - C) * 1.272);
t3 = C - ((StopLoss - C) * 1.618);
Plot(LineArray(i, StopLoss + 0.01, BarCount - 1, StopLoss + 0.01, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, C, BarCount - 1, C, 0), "", colorYellow, styleDots);
Plot(LineArray(i, t1, BarCount - 1, t1, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, t2, BarCount - 1, t2, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, t3, BarCount - 1, t3, 0), "", colorRed, styleDots | styleNoLabel);
PlotText("Stop Loss\[email protected]" + WriteVal(StopLoss + 0.01, 1.2), BarCount, StopLoss + 0.01, colorWhite);
PlotText("T1 @" + WriteVal(t1, 1.2), BarCount, t1, colorWhite);
PlotText("T2 @" + WriteVal(t2, 1.2), BarCount, t2, colorWhite);
PlotText("T3 @" + WriteVal(t3, 1.2), BarCount, t3, colorWhite);
}
break;
}
if (colorHighliter == ColorRGB(128, 128, 0)) {
StopLoss = 9999;
for (j = i - CountTrendBars; j <= i; j++) {
StopLoss = Min(L[j], StopLoss);
}
if (i - (BarCount - 1) != 0) {
t1 = C + (C - StopLoss);
t2 = C + ((C - StopLoss) * 1.272);
t3 = C + ((C - StopLoss) * 1.618);
Plot(LineArray(i, StopLoss - 0.01, BarCount - 1, StopLoss - 0.01, 0), "", colorRed, styleDots | styleNoLabel);
Plot(LineArray(i, C, BarCount - 1, C, 0), "", colorYellow, styleDots);
Plot(LineArray(i, t1, BarCount - 1, t1, 0), "", colorBrightGreen, styleDots | styleNoLabel);
Plot(LineArray(i, t2, BarCount - 1, t2, 0), "", colorBrightGreen, styleDots | styleNoLabel);
Plot(LineArray(i, t3, BarCount - 1, t3, 0), "", colorBrightGreen, styleDots | styleNoLabel);
PlotText("Stop Loss\[email protected]" + WriteVal(StopLoss - 0.01, 1.2), BarCount, StopLoss - 0.01, colorWhite);
PlotText("T1 @" + WriteVal(t1, 1.2), BarCount, t1, colorWhite);
PlotText("T2 @" + WriteVal(t2, 1.2), BarCount, t2, colorWhite);
PlotText("T3 @" + WriteVal(t3, 1.2), BarCount, t3, colorWhite);
}
break;
}
}

//Price
SetBarFillColor(colorHighliter);
Plot(C, "Close", IIf(colorHighliter == ColorRGB(128, 0, 128), ColorRGB(255, 0, 255), IIf(colorHighliter == ColorRGB(128, 128, 0), colorYellow, IIf(C > O, colorBrightGreen, IIf(C < O, colorRed, colorWhite)))), styleCandle);

//Volume
/*colorVolume = ParamColor("Volume Area", ColorRGB(0, 0, 0));
Plot(Volume, "", colorVolume, styleArea | styleOwnScale | styleNoLabel, Null, Null, 0, 0, 1);*/

Title = Name() + " - {{INTERVAL}} - {{DATE}} - Open = " + NumToStr(O, 1.2) + ", High = " + NumToStr(H, 1.2) + ", Low = " + NumToStr(L, 1.2) + ", Close = " + NumToStr(C, 1.2) + " (" + WriteVal(ROC(C, 1), 1.2) + "%)"; /*, Volume = " + WriteVal(Volume, 1.2);*/
_SECTION_END();

Use this afl.
Here you dont need to manually draw trendlines and once trendline is broken it gives targets and stoploss also.




I already have a different version of this afl posted by josh ji

actually what i want is that amibroker should play a sound alert when a manually drawn trendline is broken by price
 

KelvinHand

Well-Known Member
#6
I want to make a sound alert when a trend line is broken.
I have made a small afl by studying amibroker help file but it dose not seems to work.
I am not able to figure it out what is wrong.
This afl should play a sound alert when a support "SU" or resistance "RE" line drawn on charts are broken by closing price


////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


_SECTION_END();

_SECTION_BEGIN("Sound alarm on Trendline Break ");
////////////////////////////// Sound alarm on Trendline Break /////////////////////////////////////

BuySignal = Cross( Close, Study( "SU", GetChartID() ) );
SellSignal = Cross( Study( "SU", GetChartID() ), Close );
ShortSignal = Cross( Study( "RE", GetChartID() ), Close );
CoverSignal = Cross( Close, Study( "RE", GetChartID() ) );
//AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" + SheetNum, 1, 1+2+4+8, 20 ); //syntax for buy //signal

AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 1, 1+2, 10000 ); //Buy
AlertIf( SellSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 2, 1+2, 10000 ); //Sell
AlertIf( ShortSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 3, 1+2, 10000 ); //Short
AlertIf( Coversignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 4, 1+2, 10000 ); //Cover
/////////////////////////////////////////////////////////////////////////////
_SECTION_END();
////////////////////////////////////////////////////////////////////////////



Your help is appreciated very much.
Regards

Your AFL is working:
- Change Ding.Wav to Notify.wav for clearer sound output.
- Put up the Alert Output Window
- Draw your Trend line with "SU" to the last few bars. (try 1 TL to see the effect)
- move your cursor around this area, will beep and alert output.

Replay seen not working on this method.

This could means the alertif need to be the Current Bar print out to cross the line then it can Alert.
You can plot arrow shape to see clearly where is the cross is carried out.

However, the past crossed is not executed the AlertIF, Maybe a possibility to activate past crossed by properly coded with lastvalue() statement.
 
Last edited:

mastermind007

Well-Known Member
#7
I want to make a sound alert when a trend line is broken.
I have made a small afl by studying amibroker help file but it dose not seems to work.
I am not able to figure it out what is wrong.
This afl should play a sound alert when a support "SU" or resistance "RE" line drawn on charts are broken by closing price


////////////////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );


_SECTION_END();

_SECTION_BEGIN("Sound alarm on Trendline Break ");
////////////////////////////// Sound alarm on Trendline Break /////////////////////////////////////

BuySignal = Cross( Close, Study( "SU", GetChartID() ) );
SellSignal = Cross( Study( "SU", GetChartID() ), Close );
ShortSignal = Cross( Study( "RE", GetChartID() ), Close );
CoverSignal = Cross( Close, Study( "RE", GetChartID() ) );
//AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() + "SheetNumber" + SheetNum, 1, 1+2+4+8, 20 ); //syntax for buy //signal

AlertIf( BuySignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 1, 1+2, 10000 ); //Buy
AlertIf( SellSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 2, 1+2, 10000 ); //Sell
AlertIf( ShortSignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 3, 1+2, 10000 ); //Short
AlertIf( Coversignal, "SOUND C:\\Windows\\Media\\Ding.wav", "Trendlinebreak alert on "+FullName() , 4, 1+2, 10000 ); //Cover
/////////////////////////////////////////////////////////////////////////////
_SECTION_END();
////////////////////////////////////////////////////////////////////////////



Your help is appreciated very much.
Regards
preyanka

Whatever you are doing is the correct approach. Only thing that I'd suggest changing is lookback. It is way too high for Alert. Also, do use a better sound file. You can play any sound file with .WAV extension. Even recording of your own voice ....

whatever WAV file you wish to play, it should also play by itself by double-clicking in explorer. It should be loud enough and audible enough. So, test that first.
 
#8
Thank You
KelvinHand and mastermind007 sir for your instant reply

can we draw trend line on different scrips and get alert message when trendline is broken in any one of them

Actually i have developed a intraday trading strategy which involves trendline breaks as entry and exit areas.It removes the necessity to watch price regularly(which means emotions out of trading) and it involves money management also .
 

mastermind007

Well-Known Member
#9
Thank You
KelvinHand and mastermind007 sir for your instant reply

can we draw trend line on different scrips and get alert message when trendline is broken in any one of them

Actually i have developed a intraday trading strategy which involves trendline breaks as entry and exit areas.It removes the necessity to watch price regularly(which means emotions out of trading) and it involves money management also .
SURE, In theory, AFL should work on any scrip in which you've got study lines named SU,RE.

From my POV, you are trying something that I know exists but not really bothered about it.

I do know about naming a study feature of amibroker but I've never applied it to run a trade. I focus on more (mundane from ur POV) formula based trendlines..

(BTW, I like the pun that your AFL creates, just please do not name it SureShot)
 

Similar threads

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?