Amibroker Afl Help

#1
HI friends,


Here is one afl code simple depend upon price movement. When price go above or below mention level sound alert is active.

But problem is that when i work on another window the sound alert is not active and i miss these alert.

Here is code

_SECTION_BEGIN("SR_Xross");
su = Study("SU", GetChartID() );
re = Study("RE", GetChartID() );
PlotOHLC( re, re, su, su, "", colorLightYellow,styleCloud );
AlertIf(Cross(H, Study( "RE",GetChartID())),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakout Buy Alert", 2 );
AlertIf(Cross(Study( "SU",GetChartID()), L),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakdown Sell Alert", 2 );
_SECTION_END();


After you include the above code. Plot 2 lines on your chart.

Double click on the line to get the property dialog box

Select "RE" as StudyID for resistance line

Similarly Select "SU" as StudyID for support line


Can any one change these afl
requirment is sound alert is active when amibroker is not active window. when i work on other window at the same time if price go above re line amibroker give sound alert.


Thanks
 
#3
Try these formula,



if( Status("redrawaction") ==1 )
{
_TRACE("nTIMED REFRESH"+Now());
}
RequestTimedRefresh(1);
RequestTimedRefresh( 1, onlyvisible = False );

_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("SR_Xross");
su = Study("SU", GetChartID() );
re = Study("RE", GetChartID() );
PlotOHLC( re, re, su, su, "", colorBlack,styleCloud );
AlertIf(Cross(H, Study( "RE",GetChartID())),"SOUND C:\\Windows\\Media\\TARGET.wav", "Breakout Buy Alert", 2 );
AlertIf(Cross(Study( "SU",GetChartID()), L),"SOUND C:\\Windows\\Media\\TARGET.wav", "Breakdown Sell Alert", 2 );
_SECTION_END();
 
Last edited:
#5
Hi Friends,

These formula give sound alert when price go above RE line or go below SE line.

if( Status("redrawaction") ==1 )
{
_TRACE("nTIMED REFRESH"+Now());
}
RequestTimedRefresh(1);
RequestTimedRefresh( 1, onlyvisible = False );

_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("SR_Xross");
su = Study("SU", GetChartID() );
re = Study("RE", GetChartID() );
PlotOHLC( re, re, su, su, "", colorLightYellow,styleCloud );
AlertIf(Cross(H, Study( "RE",GetChartID())),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakout Buy Alert", 2 );
AlertIf(Cross(Study( "SU",GetChartID()), L),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakdown Sell Alert", 2 );
_SECTION_END();


After you include the above code. Plot 2 lines on your chart.

Double click on the line to get the property dialog box

Select "RE" as StudyID for resistance line

Similarly Select "SU" as StudyID for support line

These formula give sound alert when price go above RE line or go below SE line.


These formula is very use full for me. But problem is that some time its work fine but some time its meas the alert. Why i dont know.

Any one have solution on these problem.

Any one can modify these formula much better.

Pls try...........
Regards
sarita
 
Last edited:

ayush2020

Well-Known Member
#6
Hi Friends,

These formula give sound alert when price go above RE line or go below SE line.

if( Status("redrawaction") ==1 )
{
_TRACE("nTIMED REFRESH"+Now());
}
RequestTimedRefresh(1);
RequestTimedRefresh( 1, onlyvisible = False );

_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("SR_Xross");
su = Study("SU", GetChartID() );
re = Study("RE", GetChartID() );
PlotOHLC( re, re, su, su, "", colorLightYellow,styleCloud );
AlertIf(Cross(H, Study( "RE",GetChartID())),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakout Buy Alert", 2 );
AlertIf(Cross(Study( "SU",GetChartID()), L),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakdown Sell Alert", 2 );
_SECTION_END();


After you include the above code. Plot 2 lines on your chart.

Double click on the line to get the property dialog box

Select "RE" as StudyID for resistance line

Similarly Select "SU" as StudyID for support line

These formula give sound alert when price go above RE line or go below SE line.


These formula is very use full for me. But problem is that some time its work fine but some time its meas the alert. Why i dont know.

Any one have solution on these problem.

Any one can modify these formula much better.

Pls try...........
Regards
sarita
can u share 1 image of this afl ... wanna to see how this afl works...
 
#9
HI ayush,


These formula not give any buy sell signal. i draw two line on chart one is resistance and second is support. Buy when price go above resistance level and sell if price go below support level.

I want add these condition in these formula. if i add these condition i can easy add sound alert when buy or sell. and not meas any call.

If you can add these condition pls try........
 

Similar threads