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)
-   -   Hilfe bei push - nachrichten (http://www.expert-advisor.com/forum/showthread.php?t=6930)

Sirocool 03.03.21 18:41

Hilfe bei push - nachrichten
 
HEY Leute ich komm nicht mehr weiter:

Code:


if(MACD[i+] < 0 && MACD[i] > 0) PushNotifications("LONG",i);
if(MACD[i+] > 0 && MACD[i] < 0) PushNotifications("SHORT",i);


//+------------------------------------------------------------------+
//| Custom indicator iteration function PUSH_NOTIFICATION            |
//+------------------------------------------------------------------+ 

void PushNotifications(string PUSHTYPE ,int y)
{
 static datetime Zeitstempel = Time[y];
 
 if ( Zeitstempel != Time[0] )  // hier erfasst der EA, dass gerade eine neue Chartperiode begonnen hat.
      {
      Zeitstempel = Time[0]; // Angleichung der Variable, damit wieder die nächste Chartperiode erkannt werden kann.
      if(PUSHTYPE == "LONG")
      {
      SendNotification("SIGNAL:  " + PUSHTYPE + " - " + Symbol() + " - " +TIMESTRING(Period()));}
      }
}



void PushNotifications(string PUSHTYPE, int shift)
{
  int TimeCheck = 0;
  int TimeMark = iBarShift(Symbol(),PERIOD_CURRENT,lastAlertTime,0);
    if(shift <= 2 && TimeCheck != TimeMark)
    {
        TimeCheck = TimeMark;
        SendNotification("SIGNAL:  " + PUSHTYPE + " - " + Symbol() + " - " +TIMESTRING(Period()));;
        Print("PushNotification send");
       
    }
   
}

es ist egal welchen ich Teste von den beiden es kommen bei mir auf dem Handy leider zuviele Push Nachrichten.

Danke schon mal im Vorraus

traderdoc 03.03.21 19:20

if(MACD[i+] < 0 && MACD[i] > 0) PushNotifications("LONG",i);
if(MACD[i+] > 0 && MACD[i] < 0) PushNotifications("SHORT",i);

klar, bei jedem i wird gesendet!

D.h. die Abfrage nach einer neuen Kerze vor die Sende-Funktion schreiben.

traderdoc

Sirocool 03.03.21 19:50

also so ?
 
Code:

//+------------------------------------------------------------------+
//|                      SHARK_MACD_2021.mq4                        |
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+

#property icon "Shark.ico"

#property indicator_separate_window
#property indicator_buffers 1

#property indicator_level1  0
#property indicator_levelcolor clrDarkGray
#property indicator_levelstyle DRAW_ZIGZAG

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+

extern string SHARK_MACD_PARAMETER;

extern int    FAST_EMA = 12;
extern int    SLOW_EMA = 26;
extern int    MACD_SMA =  9;

input ENUM_APPLIED_PRICE Shark_Price = PRICE_CLOSE;

extern string Shark_MACD_ALERT;
extern bool  PUSH_MOBILE_ALERT  = true; 
 
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double SHARK_BUFFER_M[];
datetime time_alert;

int OnInit()
  {
  IndicatorBuffers(1);
  SetIndexBuffer(0,SHARK_BUFFER_M);SetIndexLabel(0,NULL);SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3,clrSnow);
  return(INIT_SUCCEEDED);
  }
int start()
{

int counted_bars=IndicatorCounted(),limit,i,r;
  if(counted_bars<0) return(-1);
  limit=Bars-counted_bars;

for (i=limit, r=Bars-i-1; i>=0 && !IsStopped(); i--,r++)
{
SHARK_BUFFER_M[i] = iMACD(Symbol(),PERIOD_CURRENT,FAST_EMA,SLOW_EMA,MACD_SMA,Shark_Price,MODE_MAIN,i);
if(SHARK_BUFFER_M[i+1] < 0 && SHARK_BUFFER_M[i] > 0 )
{
if(i == 0 && Time[0] != time_alert) { myAlert("BUY"); time_alert = Time[0];}
}
if(SHARK_BUFFER_M[i+1] > 0 && SHARK_BUFFER_M[i] < 0 )
{
if(i == 0 && Time[0] != time_alert) { myAlert("SELL"); time_alert = Time[0];}
}

 
}





return(0);
}


void myAlert(string type)
  {
 
     
    if(type == "error")
    {
      Print(type+" | SHARK_MACD_2021 @ "+Symbol()+","+IntegerToString(Period()));
    }
  else if(type == "SELL")
    {
    if(PUSH_MOBILE_ALERT) SendNotification(type+" | SHARK_MACD_2021 @ "+Symbol()+","+IntegerToString(Period()));
    }
  else if(type == "BUY")
    {
      if(PUSH_MOBILE_ALERT) SendNotification(type+" | SHARK_MACD_2021 @ "+Symbol()+","+IntegerToString(Period()));
    }
  }


traderdoc 03.03.21 20:23

Und? Wie verhalten sich die Pushs?

traderdoc

Sirocool 04.03.21 10:16

?
 
Werde ich heute am 04.03.21 live sehen lass den heute mal testen. gestern der kurze test sah relativ gut aus

Sirocool 04.03.21 16:23

So Fertig
 
Funktioniert einwandfrei mit allen jetzt


https://www.bilder-upload.eu/bild-20...71633.jpg.html

https://www.bilder-upload.eu/bild-6f...71680.jpg.html


Alle Zeitangaben in WEZ +2. Es ist jetzt 11:52 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