Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools

Metatrader Forum | Forex Expert-Advisor | Broker & Forex Tools (http://www.expert-advisor.com/forum/index.php)
-   Programmierung MQL4 (http://www.expert-advisor.com/forum/forumdisplay.php?f=220)
-   -   Alert nur einmal generieren (http://www.expert-advisor.com/forum/showthread.php?t=3311)

Solar 26.10.13 18:49

Alert nur einmal generieren
 
Hi,

ich habe folgendes Script im Netz gefunden und es etwas an meine Bedürfnisse angepasst. Die Funktion ist soweit Ok allerdings möchte ich das ein Alarm nur einmal ausgeführt wird. Wie läßt sich das einstellen ?

Code:

//+------------------------------------------------------------------+
//|                                                  Alert.mq4 |
//+------------------------------------------------------------------+


#property indicator_chart_window
extern string TLineName1="TL1";
extern string TLineName2="TL2";
extern color LineColor=Red;
extern color LineColor2=Green;
extern int LineStyle=STYLE_SOLID;
extern int AlertPipRange=5;
extern string AlertWav="alert.wav";

 

//+------------------------------------------------------------------+
//| Custom indicator initialization function                        |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
  return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                      |
//+------------------------------------------------------------------+
int deinit()
  {
//----
 
//----
  return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int start()
  {
   
  int    counted_bars=IndicatorCounted();
      ObjectCreate(TLineName1, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);
      ObjectSet(TLineName1, OBJPROP_STYLE, LineStyle);
      ObjectSet(TLineName1, OBJPROP_COLOR, LineColor);

      double val=ObjectGetValueByShift(TLineName1, 0);
 
      if (Bid-AlertPipRange*Point <= val && Bid+AlertPipRange*Point >= val) Alert( Symbol()," Price at Level TL1");
 
   
      ObjectCreate(TLineName2, OBJ_TREND, 0, Time[25], Bid, Time[0], Ask);
      ObjectSet(TLineName2, OBJPROP_STYLE, LineStyle);
      ObjectSet(TLineName2, OBJPROP_COLOR, LineColor2);

      double val2=ObjectGetValueByShift(TLineName2, 0);
 
      if (Bid-AlertPipRange*Point <= val2 && Bid+AlertPipRange*Point >= val2) Alert( Symbol()," Price at Level TL2"); 
     

//----
//----
  return(0);
  }
//+------------------------------------------------------------------+


fxdaytrader 25.12.13 11:21

trendline alerts
 
Liste der Anhänge anzeigen (Anzahl: 1)
das sollte so funktionieren (nicht getestet), s. Anhang


Alle Zeitangaben in WEZ +1. Es ist jetzt 13:59 Uhr.

Powered by vBulletin® Version 3.8.5 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.1
Powered by vBCMS® 2.7.0 ©2002 - 2024 vbdesigns.de
Copyright ©2009 - 2023 by Expert-Advisor.com - Das Metatrader Forum