Powtarzajacy się ALARM
Powtarzajacy się ALARM
Witam,
Chciałem zwrócić się o pomoc w takiej oto sprawie. Jest warunek, który się spełnia i następuje Alarm (a w zasadzie seria alarmów w ciągu kilku, kilkunastu sekund - bardzo męczące).
Jak zapisać kod alarmu, żeby powtórzył się tylko raz. Pozdrawiam!
CCI11 = iCCI(NULL, 0, CCI1, 5, 1);
CCI12 = iCCI(NULL, 0, CCI1, 5, 2);
if ( CCI12 > -200 && CCI11 < -200 ) PlaySound ("alert.wav"); Alert(Symbol());
if ( CCI12 < 200 && CCI11 > 200 ) PlaySound ("alert.wav"); Alert(Symbol());
Chciałem zwrócić się o pomoc w takiej oto sprawie. Jest warunek, który się spełnia i następuje Alarm (a w zasadzie seria alarmów w ciągu kilku, kilkunastu sekund - bardzo męczące).
Jak zapisać kod alarmu, żeby powtórzył się tylko raz. Pozdrawiam!
CCI11 = iCCI(NULL, 0, CCI1, 5, 1);
CCI12 = iCCI(NULL, 0, CCI1, 5, 2);
if ( CCI12 > -200 && CCI11 < -200 ) PlaySound ("alert.wav"); Alert(Symbol());
if ( CCI12 < 200 && CCI11 > 200 ) PlaySound ("alert.wav"); Alert(Symbol());
Każdy żyje we własnym kłamstwie.
- Pierz Andrzej
- Przyjaciel Forum
- Posty: 1200
- Rejestracja: 02 lip 2006, 14:17
mozesz skorzystac z funkcji bodajze sie Tig3r`a
pozatym masz zle napisane warunki w ten spsob bedzie alarm co tick nawet jak nie spelni warunkow 
powinno byc
Kod: Zaznacz cały
bool isNewBar() {
static int prevTime;
bool newBar=false;
if(Time[0]!=prevTime) {
newBar=true;
prevTime=Time[0];
}
return(newBar);
}

Kod: Zaznacz cały
if ( CCI12 > -200 && CCI11 < -200 ) PlaySound ("alert.wav"); Alert(Symbol());
if ( CCI12 < 200 && CCI11 > 200 ) PlaySound ("alert.wav"); Alert(Symbol());
Kod: Zaznacz cały
if ( CCI12 > -200 && CCI11 < -200 ){ PlaySound ("alert.wav"); Alert(Symbol()); }
if ( CCI12 < 200 && CCI11 > 200 ) {PlaySound ("alert.wav"); Alert(Symbol());}
- Pierz Andrzej
- Przyjaciel Forum
- Posty: 1200
- Rejestracja: 02 lip 2006, 14:17
zebys mial jeden dzwiek na sygnale daj takie warunki
Kod: Zaznacz cały
if ( CCI12 > -200 && CCI11 < -200 )if (isNewBar()) { PlaySound ("alert.wav"); Alert(Symbol()); }
if ( CCI12 < 200 && CCI11 > 200 )if (isNewBar()) {PlaySound ("alert.wav"); Alert(Symbol());}
z poważaniem
Andrzej Pierz
FOREX-SERVICE
Andrzej Pierz
FOREX-SERVICE
- Pierz Andrzej
- Przyjaciel Forum
- Posty: 1200
- Rejestracja: 02 lip 2006, 14:17
IsNewBar() jest funkcja wiec nie mozesz go wkleic do innej funkcji w tym wypadku wkleiles do funkcji start()
powinno byc tak :
powinno byc tak :
Kod: Zaznacz cały
#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 OliveDrab // Up Trend
#property indicator_color2 IndianRed // Dw Trend
#property indicator_color3 DarkGray // CCI1
#property indicator_color4 Gold // CCI2
#property indicator_color5 Lime // LSMA2
#property indicator_color6 Black // LSMA3
extern int CCI1 = 14;
extern int CCI2 = 56;
extern int CCI3 = 168;
extern int CCI4 = 280;
extern int CountBars = 500;
extern int Lv1 = 200;
extern int Digit = 4;
extern bool Show_CCI1 = true;
extern bool Show_CCI2 = true;
extern bool Show_CCI3 = true;
extern bool Show_CCI4 = true;
double CCI_1[];
double CCI_2[];
double CCI_3[];
double CCI_4[];
double CCIHistogramUpBuffer[];
double CCIHistogramDownBuffer[];
double CCI11, CCI12;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle (0, DRAW_HISTOGRAM, 1, 2);
SetIndexBuffer(0, CCIHistogramUpBuffer);
SetIndexStyle (1, DRAW_HISTOGRAM, 1, 2);
SetIndexBuffer(1, CCIHistogramDownBuffer);
SetIndexStyle (2, DRAW_LINE, STYLE_DOT, 1);
SetIndexBuffer(2, CCI_1);
SetIndexStyle (3, DRAW_LINE, STYLE_SOLID, 1);
SetIndexBuffer(3, CCI_2);
SetIndexStyle (4, DRAW_LINE, STYLE_SOLID, 2);
SetIndexBuffer(4, CCI_3); //
SetIndexStyle (5, DRAW_LINE, STYLE_SOLID, 2);
SetIndexBuffer(5, CCI_4); //
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
double r;
int m,s,k;
m=Time[0]+Period()*60-CurTime();
r=m/60.0;
s=m%60;
m=(m-m%60)/60;
ObjectDelete("xard1");
ObjectCreate("xard1", OBJ_LABEL, 2, 0, 0);
ObjectSetText("xard1",m+":"+s , 16, "Arial", Yellow);
ObjectSet("xard1", OBJPROP_CORNER, 1);
ObjectSet("xard1", OBJPROP_XDISTANCE, 5);
ObjectSet("xard1", OBJPROP_YDISTANCE, 25);
ObjectDelete("xard2");
ObjectCreate("xard2", OBJ_LABEL, 2, 0, 0);
ObjectSetText("xard2",DoubleToStr(Bid,Digit) , 16, "Arial", Yellow);
ObjectSet("xard2", OBJPROP_CORNER, 1);
ObjectSet("xard2", OBJPROP_XDISTANCE, 5);
ObjectSet("xard2", OBJPROP_YDISTANCE, 0);
int limit, i, prevTime;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
limit=Bars-counted_bars;
SetIndexDrawBegin(0, Bars - CountBars);
SetIndexDrawBegin(1, Bars - CountBars);
SetIndexDrawBegin(2, Bars - CountBars);
SetIndexDrawBegin(3, Bars - CountBars);
SetIndexDrawBegin(4, Bars - CountBars);
SetIndexDrawBegin(5, Bars - CountBars);
for(i = 0; i <= limit; i++) { CCI_4[i] = iCCI(NULL, 0, CCI4, 5, i);
if (CCI_4[i] >= 0 ) CCIHistogramUpBuffer[i] = CCI_4[i];
else CCIHistogramUpBuffer[i] = 0;
if (CCI_4[i] < 0 ) CCIHistogramDownBuffer[i] = CCI_4[i];
else CCIHistogramDownBuffer[i]=0;
if (Show_CCI1 == true) {CCI_1[i] = iCCI(NULL, 0, CCI1, 5, i);}
if (Show_CCI2 == true) {CCI_2[i] = iCCI(NULL, 0, CCI2, 5, i);}
if (Show_CCI3 == true) {CCI_3[i] = iCCI(NULL, 0, CCI3, 5, i);}}
CCI11 = iCCI(NULL, 0, CCI1, 5, 1);
CCI12 = iCCI(NULL, 0, CCI1, 5, 2);
if ( CCI12 > (-Lv1) && CCI11 < (-Lv1) ) if (isNewBar()) { PlaySound ("Alert.wav"); Alert(Symbol());}
if ( CCI12 < Lv1 && CCI11 > Lv1 ) if (isNewBar()) { PlaySound ("Alert.wav"); Alert(Symbol());}
if ( CCI12 < (-Lv1) && CCI11 > (-Lv1) ) if (isNewBar()) { PlaySound ("Alert.wav"); Alert(Symbol());}
if ( CCI12 > Lv1 && CCI11 < Lv1 ) if (isNewBar()) { PlaySound ("Alert.wav"); Alert(Symbol());}
return(0);
}
//+------------------------------------------------------------------+
bool isNewBar() {
static int prevTime;
bool newBar=false;
if(Time[0]!=prevTime) {
newBar=true;
prevTime=Time[0];
}
return(newBar);
}
z poważaniem
Andrzej Pierz
FOREX-SERVICE
Andrzej Pierz
FOREX-SERVICE
Pierz Andrzej pisze:zebys mial jeden dzwiek na sygnale daj takie warunki
Kod:
if ( CCI12 > -200 && CCI11 < -200 )if (isNewBar()) { PlaySound ("alert.wav"); Alert(Symbol()); }
if ( CCI12 < 200 && CCI11 > 200 )if (isNewBar()) {PlaySound ("alert.wav"); Alert(Symbol());}
Tak chyba ładniej

Kod: Zaznacz cały
if ( CCI12 > -200 && CCI11 < -200 && isNewBar()) { PlaySound ("alert.wav"); Alert(Symbol()); }
if ( CCI12 < 200 && CCI11 > 200 && isNewBar()) {PlaySound ("alert.wav"); Alert(Symbol());}
======================================================
Nie głupi ten co nie wie, lecz ten który nie chce się nauczyć..
Nie głupi ten co nie wie, lecz ten który nie chce się nauczyć..
- Pierz Andrzej
- Przyjaciel Forum
- Posty: 1200
- Rejestracja: 02 lip 2006, 14:17
Z tego co się orientuję to sprawdzenie leci od lewej do prawej i w momencie gdy trafi na pierwsze False to nie sprawdza dalejPierz Andrzej pisze:wiec nie widze sensu sprawdzania czy jest to nowa swieca skoro nie ma sygnaly od CCI
======================================================
Nie głupi ten co nie wie, lecz ten który nie chce się nauczyć..
Nie głupi ten co nie wie, lecz ten który nie chce się nauczyć..