Sygnał który się zapętla

ODPOWIEDZ
no avatar
Autorun
Posty: 12
Rejestracja: środa 09 kwie 2014, 18:43

Sygnał który się zapętla

środa 29 paź 2014, 16:22

Witam bardzo serdecznie wszystkich mam problem, a mianowicie chciałem zrobić sobie alert na RSI że gdy dotknie danego poziomu wyskakuje okienko i alert, jednak alert jest powtarzany non-stop załączam kod, proszę pomóżcie !!!

Kod: Zaznacz cały

//+------------------------------------------------------------------+
//|                                                    RSI-Alert.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 3
#property indicator_color1 DodgerBlue
#property indicator_color2 LightGray
#property indicator_color3 LightGray
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 1
#property indicator_style1 STYLE_SOLID
#property indicator_style2 STYLE_DOT
#property indicator_style3 STYLE_DOT
//---- input parameters
extern int RSIPeriod=14;
extern int ApplyTo=0;
extern bool AlertMode=true;
extern int OverBought=70;
extern int OverSold=30;
//---- buffers
double RSIBuffer[];
double RSIOBBuffer[];
double RSIOSBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator lines
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,RSIBuffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,RSIOBBuffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,RSIOSBuffer);
//---- name for DataWindow and indicator subwindow label
   short_name="RSI-Alert("+RSIPeriod+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
   SetIndexLabel(1,"OverBought");
   SetIndexLabel(2,"OverSold");
//----
   SetIndexDrawBegin(0,RSIPeriod);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Relative Strength Index                                          |
//+------------------------------------------------------------------+
int start()
  {
   int    i,counted_bars=IndicatorCounted();
//----
   if(Bars<=RSIPeriod) return(0);
//----
   i=Bars-RSIPeriod-1;
   if(counted_bars>=RSIPeriod) i=Bars-counted_bars-1;
   while(i>=0)
   {
      RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,ApplyTo,i);
      RSIOBBuffer[i]=OverBought;
      RSIOSBuffer[i]=OverSold;
      i--;
   }
   
   if(AlertMode)
   {
      if(RSIBuffer[1]<OverBought && RSIBuffer[0]>=OverBought)
         Alert("RSI "+RSIPeriod+ ", Sell  Level "+OverBought+" - "+Symbol()+" M"+Period()+"  "+DoubleToStr(Bid,Digits)+"");
         
         }
   {
      if(RSIBuffer[1]>OverSold && RSIBuffer[0]<=OverSold)
         Alert("RSI "+RSIPeriod+ ", Buy  Level "+OverSold+" - "+Symbol()+" M"+Period()+"  "+DoubleToStr(Bid,Digits)+"");
         
   }
//----
   return(0);
   
  }
//+------------------------------------------------------------------+
!problem!
Obrazek
Jeżeli da radę to przerobić by wyskakiwał jeden alert zamiast 1000~~ to nakierujcie mnie !!

no avatar
Wishermil
Stały Bywalec
Posty: 68
Rejestracja: wtorek 11 mar 2014, 19:57
Lat na Forex: 0
Rodzaj rachunku: Rachunek rzeczywisty

Re: Sygnał który się zapętla

sobota 15 lis 2014, 17:01

Zrób warunek, czy alert był wyświetlony i tyle.

Ustawiaj go na 0,1.

ODPOWIEDZ

Kto jest online

Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 13 gości