Jump to content

{REQ} need help alert sound for indicator


scalperX

Recommended Posts

halo agan2

saya mohon bantuan nih

 

gimana caranya nambahin alert pada indi berikut :

(jadi setiap panah muncul akan ada alert gitu ... )

 



#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int       NumBars=500;
extern bool SoundON=true;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double spread;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
 {
//---- indicators
  SetIndexStyle(0,DRAW_ARROW);
  SetIndexBuffer(0,ExtMapBuffer1);
  SetIndexArrow(0,233);
  SetIndexStyle(1,DRAW_ARROW);
  SetIndexBuffer(1,ExtMapBuffer2);
  SetIndexArrow(1,234);
  spread=MarketInfo(Symbol(),MODE_SPREAD)*Point;
//----
  return(0);
 }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
 {
//---- 
  
//----
  return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  int    counted_bars=IndicatorCounted();
//---- 
  
int       artp=7;
double    dartp=7.0;
double    cecf=0.7;
int       satb=0;
int       Shift=0;
bool      river=True;
double    Emaxtra=0;
double    widcha=0;
double    TR=0;
double    Values[100];
int       glava=0;
double    ATR=0;
int       J=0;
double    Weight=0;
double    r=0;
double    r1=0;
int       p=0;
int       Curr=0;
double    Range1=0;
double    s=2;
double    f=10;
double    val1=0;
double    val2=0;
double    h11=0;
double    h12=0;
double    h13=0;
double    const=0;
double    orig=0;
double    st=0;
double    h2=0;
double    h1=0;
double    h10=0;
double    sxs=0;
double    sms=0;
double    temp=0;
double    h5=0;
double    r1s=0;
double    r2s=0;
double    r3s=0;
double    r4s=0;
double    pt=0;
double    pts=0;
double    r2=0;
double    r3=0;
double    r4=0;
double    tt=0;


  if( Bars < NumBars) satb = Bars; else satb = NumBars;
  if( Close[satb - 2] > Close[satb - 1]) river = True; else river = False;
  Emaxtra = Close[satb - 2];
  Shift=satb-3;
  while(Shift>=0)      {
     TR = spread+ High[shift] - Low[shift];
     if( MathAbs(spread+ High[shift] - Close[shift + 1]) > TR ) TR = MathAbs(spread+ High[shift] - Close[shift + 1]);
     if( MathAbs(Low[shift] - Close[shift + 1]) > TR)  TR = MathAbs(Low[shift] - Close[shift + 1]);
     if (Shift == satb - 3 ) {
        for(J=0;Shift<=artp-1;J++) { 
        	Values[J] = TR; 
        }
     }   
		Values[glava] = TR;
     ATR = 0;
     Weight = artp;
     Curr = glava;
     for (J = 0;J<=artp - 1;J++) {
        ATR += Values[Curr] * Weight;
        Weight -= 1.0;
        Curr--;
        if (Curr == -1) Curr = artp - 1;
     }
     ATR = 2.0 * ATR / (dartp * (dartp + 1.0));
     glava++;
     if (glava == artp) glava = 0;
     widcha = cecf * ATR;
     if (river && Low[shift] < Emaxtra - widcha) {
        river = False;
        Emaxtra = spread+ High[shift];
     }
     if (!river && spread+ High[shift] > Emaxtra + widcha) {
        river = True;
        Emaxtra = Low[shift];
     }
     if (river && Low[shift] > Emaxtra) {
        Emaxtra = Low[shift];
     }
     if (!river && spread+ High[shift] < Emaxtra ) {
        Emaxtra = spread+ High[shift];
     }
     Range1 = iATR(NULL,0,10,Shift);
     val1 = 0;
     val2 = 0;
     if (river) {
        if (p != 1) r1 = Low[shift] - Range1 * s / 3.0;
        if (p == 1) r1 = -1.0;
        if (r1 > 0) {
           val1 = r1;
           val2 = 0;
        } else {
           val1 = 0;
           val2 = 0;
        }
        ExtMapBuffer1[shift]=val1;
        p = 1;
     } else {
        if (p != 2) r1 = spread+ High[shift] + Range1 * s / 3.0;
        if (p == 2) r1 = -1.0;
        if (r1 > 0) {
           val1 = 0;
           val2 = r1;
        } else {
           val1 = 0;
           val2 = 0;
        }
        ExtMapBuffer2[shift]=val2;
        p = 2;
     }
     Shift--;
  }
  
//----
  return(0);
 }
//+------------------------------------------------------------------+


 

mohon bantuannya

dan mohon maaf jika salah kamar atau salah buat thread

 

sebelum dan sesudahnya saya ucapkan terima kasih

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...