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)
-   -   Suche einen selten genutzten MQL Befehl! (http://www.expert-advisor.com/forum/showthread.php?t=4026)

pako 23.01.15 16:34

Liste der Anhänge anzeigen (Anzahl: 2)
Zitat:

Zitat von traderdoc (Beitrag 28367)
Ne @pako, Dateiendung ist falsch und da er etwas aus der Datei auslesen möchte, wäre auch das FILE_WRITE falsch!

Wenn dann so:

int filehandle = FileOpen("Datei.csv", FILE_READ|FILE_CSV);
:)

traderdoc

Er will die *.exe Datei ausführen

traderdoc 23.01.15 16:40

Zitat:

Zitat von pako (Beitrag 28369)
Er will die *.exe Datei ausführen

Von *.exe hatte er in Post#1 nichts geschrieben. Und die *.csv war ein Beispiel.

traderdoc

Nap$ter 23.01.15 16:52

Liste der Anhänge anzeigen (Anzahl: 1)
Jap ich will eine *.exe Datei ausführen. Hatte ich im Post#1 vergessen sorry.
Und später vielleicht noch eine *.au3 Datei, aber diese wird vermutlich nicht gehen oder?

Kann jemand von euch diesen Befehl kurz in den Indikator mit rein reinschreiben, bin noch am Angfang mit der MQL Programmierung? :confused:

traderdoc 23.01.15 17:07

Das ist eben ganz wichtig, dass man sich eineindeutig ausdrückt und auch schreibt, was man will, sonst bekommt evtl. etwas anderes.

traderdoc

Nap$ter 23.01.15 17:17

Da gebe ich dir vollkommen recht. Dachte halt nur das die Screenshots ausreichen, da auf beiden Screen jeweils eine *.exe Datei geöffnet werden sollte.

Nap$ter 26.01.15 15:59

Liste der Anhänge anzeigen (Anzahl: 1)
So habe mich mal dran gemacht und versucht den Befehl in einen Indikator einzubauen. Leider funktioniert es nicht. Vermutlich irgendwo ein Fehler. Die "Test.exe" Datei ist im File Ordner des MT4's. Hab noch wenig Erfahrung mit dem Programieren von MQL. :confused:
Auszug aus dem Indikator:

Code:


#property copyright "Copyright © 2015 - R.ST"
#property link      ""

#property indicator_separate_window
#property indicator_minimum -35.0
#property indicator_maximum 35.0
#property indicator_buffers 5
#property indicator_color1 clrDodgerBlue
#property indicator_color2 clrDodgerBlue
#property indicator_color3 clrRed
#property indicator_color4 clrLime
#property indicator_level2 12.0
#property indicator_level3 -12.0
#property indicator_style1 2;

extern int period =4;
extern ENUM_MA_METHOD MaMethod=MODE_SMA;
extern ENUM_APPLIED_PRICE MaPrice = PRICE_MEDIAN;

extern int RSIPeriod=4;
extern ENUM_APPLIED_PRICE RsiPrice=PRICE_CLOSE;
extern double RsiOverBoughtLevel=90.0;
extern double RsiOverSoldLevel=10.0;

extern double Level =24.0;

extern bool  alertsOn        = true;
extern bool  alertsOnCurrent = true;
extern bool  alertsMessage  = true;
extern bool  alertsNotification = false;
extern bool  alertsSound    = false;
extern bool  alertsEmail    = false;
extern bool  filehandle      = true;

double AboveBuff[],ShortBuff[],LongBuff[],BelowBuff[];
double RSIBuffer[];

// ---
int init() {
  SetIndexBuffer(0, AboveBuff); SetIndexStyle(0, DRAW_HISTOGRAM, EMPTY, 2);                          // Lime Above 0
  SetIndexBuffer(1, BelowBuff); SetIndexStyle(1, DRAW_HISTOGRAM, EMPTY, 2);                          // Lime Below 0
  SetIndexBuffer(2, ShortBuff); SetIndexStyle(2, DRAW_ARROW, EMPTY, 2);      SetIndexArrow(2, 108); // Red
  SetIndexBuffer(3, LongBuff); SetIndexStyle(3, DRAW_ARROW, EMPTY, 2);      SetIndexArrow(3, 108); // Blue

  SetIndexLabel(0, "Above");
  SetIndexLabel(1, "Below"); 
  SetIndexLabel(2, "SHORT"); 
  SetIndexLabel(3, "LONG");
 
  SetIndexBuffer(4,RSIBuffer);
  SetIndexStyle(4,DRAW_NONE);
 
  SetLevelStyle(STYLE_DOT, 0, SteelBlue);

  IndicatorShortName(" Similar to Fx MTN + RSI ");
  return (0);
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
// ---
int deinit() {
 return(0);
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
// ---
int start() {

  int filehandle=FileOpen("Test.exe",FILE_WRITE|FILE_CSV);

  int counted_bars=IndicatorCounted();
      if(counted_bars<0) return(-1);
      if(counted_bars>0) counted_bars--;
          int limit=MathMin(Bars-counted_bars,Bars-1);
     
      for (int i = limit; i >=0; i--)
      {
        //double Temp = 0.0; for (int j = i; j < i + Per; j++) Temp += (High[j] + Low[j]) / 2.0;
        double Main =iMA(NULL,0,period,0,MaMethod,MaPrice,i) ;//Temp / Per;
              //  Temp = 0.0;  for (j = i; j < i + Per; j++) Temp += High[j] - Low[j];
        double Minr = 0.2 * iATR(NULL,0,period,i);//(Temp / Per);
       
            if (Minr!=0)
            {
              AboveBuff[i] = 3.0 * (High[i]  - Main) / Minr;
              BelowBuff[i] = 3.0 * (Low[i]  - Main) / Minr;
            }             
            ShortBuff[i] = EMPTY_VALUE;
            LongBuff[i] = EMPTY_VALUE;
            if (AboveBuff[i] >  Level) ShortBuff[i] =  Level+1;
            if (BelowBuff[i] < -Level) LongBuff[i] = -(Level+1);
        //rsi:
        RSIBuffer[i]=iRSI(NULL,0,RSIPeriod,RsiPrice,i);
      }
  manageAlerts();
  return(0);
}

//+-------------------------------------------------------------------
//|                                                                 
//+-------------------------------------------------------------------
void manageAlerts()
{
  if (alertsOn)
  {
      if (alertsOnCurrent)
          int whichBar = 0;
      else    whichBar = 1;
      if (ShortBuff[whichBar] != EMPTY_VALUE || LongBuff[whichBar] != EMPTY_VALUE)
      {
        if (ShortBuff[whichBar] !=  EMPTY_VALUE &&  GetRsiAlert(whichBar)==OP_SELL)doAlert(whichBar,"down + RSI overbougth @ Level " +RsiOverBoughtLevel);
        if (LongBuff[whichBar] !=  EMPTY_VALUE  && GetRsiAlert(whichBar)==OP_BUY) doAlert(whichBar,"up + RSI oversold @ Level " +RsiOverSoldLevel);
      }
  }
}

//
//
//
//
//

void doAlert(int forBar, string doWhat)
{
  static string  previousAlert="nothing";
  static datetime previousTime;
  string message;
 
  if (previousAlert != doWhat || previousTime != Time[forBar]) {
      previousAlert  = doWhat;
      previousTime  = Time[forBar];

      //
      //
      //
      //
      //

      message =  StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," SimilarFxMNT signal ",doWhat);
          if (alertsMessage) Alert(message);
          if (alertsEmail)  SendMail(StringConcatenate(Symbol()," SimilarFxMNT "),message);
          if (alertsNotification) SendNotification(message);
          if (alertsSound)  PlaySound("alert2.wav");
          if (filehandle)    FileOpen("Test.exe",FILE_READ|FILE_CSV);
         
  }
}

int GetRsiAlert(int AlertCandle) {
 if(RSIBuffer[AlertCandle+1]<RsiOverBoughtLevel && RSIBuffer[AlertCandle]>RsiOverBoughtLevel) return(OP_SELL);//RSI RsiOverBoughtLevel
 if(RSIBuffer[AlertCandle+1]>RsiOverSoldLevel && RSIBuffer[AlertCandle]<RsiOverSoldLevel) return(OP_BUY);//RSI RsiOverSoldLevel
 return(99);//nothing
}

Leider wird beim Alarm die "Test.exe" nicht geöffnet...
Indikator im Anhang. Wäre cool von euch wenn sich jemand diesen mal kurz anschaut und die Fehler beseitigt. :)

pako 26.01.15 17:22

Zitat:

Zitat von Nap$ter (Beitrag 28397)
So habe mich mal dran gemacht und versucht den Befehl in einen Indikator einzubauen. Leider funktioniert es nicht. Vermutlich irgendwo ein Fehler. Die "Test.exe" Datei ist im File Ordner des MT4's. Hab noch wenig Erfahrung mit dem Programieren von MQL. :confused:


Leider wird beim Alarm die "Test.exe" nicht geöffnet...
Indikator im Anhang. Wäre cool von euch wenn sich jemand diesen mal kurz anschaut und die Fehler beseitigt. :)

Paht "Test.exe" ???

Nap$ter 26.01.15 18:01

Zitat:

Zitat von pako (Beitrag 28400)
Paht "Test.exe" ???

Ich habe eine Test.exe geschrieben zum testen oder was meinst du? Fände es cool wenn du mir den Fehler korrieren könntest, hab wenig erfahrung mit MQL. :confused:

pako 26.01.15 18:09

Zitat:

Zitat von Nap$ter (Beitrag 28403)
Ich habe eine Test.exe geschrieben zum testen oder was meinst du? Fände es cool wenn du mir den Fehler korrieren könntest, hab wenig erfahrung mit MQL. :confused:

adress von "Test.exe"???

zum Beispiel - C:\Program Files (x86)\MetaTrader 4 Terminal\MQL4\Files\Test.exe

pako 26.01.15 18:20

Code:

//+------------------------------------------------------------------+
//|                                          Check_TerminalPaths.mq4 |
//|                        Copyright 2009, MetaQuotes Software Corp. |
//|                                              https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2009, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version  "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
  Print("TERMINAL_PATH = ",TerminalInfoString(TERMINAL_PATH));
  Print("TERMINAL_DATA_PATH = ",TerminalInfoString(TERMINAL_DATA_PATH));
  Print("TERMINAL_COMMONDATA_PATH = ",TerminalInfoString(TERMINAL_COMMONDATA_PATH));
  }



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