Amibroker afl code help

#1
HI friends,

i trade only in bank nifty use amibroker software.
i want one afl those totaly depand on price action

two condition in afl

if current market price is 12500

first sound alert if market price cross above 12525.

second sound alert if market price cross below 12475.


pls try....

Thanks
 
#2
HI friends,

i trade only in bank nifty use amibroker software.
i want one afl those totaly depand on price action

two condition in afl

if current market price is 12500

first sound alert if market price cross above 12525.

second sound alert if market price cross below 12475.


pls try....

Thanks
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();

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

  2. Double click on the line to get the property dialog box

  3. Select "RE" as StudyID for resistance line

  4. Similarly Select "SU" as StudyID for support line


Now place these 2 lines RE & SU wherever you want the buy and sell alert to be sounded at the levels of your choosing, enjoy :thumb:.
 
#3
Thanks PartTime_Trader,

Its working fine thanks very much. can you change one condition alert sound is only ding and very short.

can you add one log sound alert like any mobile ring tone....

pls try for me....

and finally thanks again for good afl.
Thanks:clap::clapping:
 
Last edited:
#4
Thanks PartTime_Trader,

Its working fine thanks very much. can you change one condition alert sound is only ding and very short.

can you add one log sound alert like any mobile ring tone....

pls try for me....

and finally thanks again for good afl.
Thanks:clap::clapping:
It can be easily done, you can even play a song, other music etc, :)

All the windows installations usually have the wav file for ding sound, but i have no idea what other sound files you have on your comp.

Try this copy a sound file (.wav format) to root of C drive i.e C:\, then replace the following string with the file name

"SOUND C:\\FileNameComesHere.wav"

in place of following string

"SOUND C:\\Windows\\Media\\Ding.wav"

replace in the original code
Code:
AlertIf(Cross(Study( "SU",GetChartID()), L),"SOUND C:\\Windows\\Media\\Ding.wav", "Breakdown Sell Alert", 2 );
 
#5
Thanks one again PartTime_Trader,

one major problem is when i not display amibroker screen and work on other screen that time if price go above or below price level amibroker not give me sound alert.
Amibroker give me sound alert only when i display amibroker screen why?

You have any idea to solved these problem?

Thanks
 
#6
Thanks one again PartTime_Trader,

one major problem is when i not display amibroker screen and work on other screen that time if price go above or below price level amibroker not give me sound alert.
Amibroker give me sound alert only when i display amibroker screen why?

You have any idea to solved these problem?

Thanks
Try this

Instead of plotting lines and using Study IDs, use 2 parameters to define support and resistance levels (use Param) and setup a buy/sell alert on cross of these levels, this should play the sound even if AB is not active window (working in background)
 
#7
Hi PartTime_Trader,

How to use param i don't know. can you add these param parameters in our original alf 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();

Pls add these two addition line in our original alf code.

Thanks
 
#8
Hello partTime trader,

How to use these use 2 parameters to define support and resistance levels.

and how to setup a buy/sell alert on cross of these levels.

I have no idea regarding param parameter.

pls add these all condition in our original formula.

Thanks
 

Steve

Active Member
#10
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();

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

  2. Double click on the line to get the property dialog box

  3. Select "RE" as StudyID for resistance line

  4. Similarly Select "SU" as StudyID for support line


Now place these 2 lines RE & SU wherever you want the buy and sell alert to be sounded at the levels of your choosing, enjoy :thumb:.

Thanks for above code.:thumb:
 

Similar threads