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)
-   -   Indikator funktioniert nicht direkt nach dem Start (http://www.expert-advisor.com/forum/showthread.php?t=4796)

Fiisk 17.02.16 18:23

Indikator funktioniert nicht direkt nach dem Start
 
Hallo zusammen,

ich habe da mal eine hoffentlich nicht all zu dumme Frage.

Wenn ich MT4 starte, startet ja automatisch das letzte Profil. Dieses enthält mehrere Charts. In einem der Charts habe ich einen eigenen Indikator laufen. Das Problem ist, dass dieser Indi erstmal nichts tut.
Erst wenn ich
- das Timeframe ändere oder
- das Symbol ändere oder
- den Code im Editor kompiliere oder
- das Profil wechsele und wieder das gewünschte Profil aufrufe
fängt der Indi an das zu tun was er soll.

Den Code habe ich in einem OnCalculate-Block stehen.

Kann das jemand erklären ?

Vielen vielen Dank
Markus

//+------------------------------------------------------------------+
//| mg_123_Scanner_kompakt.mq4 |
//| MG |
//| |
//+------------------------------------------------------------------+
#property copyright "MG"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 4

//01#####Beginn INPUTS############################################ #############################
//hier stehen die Inputs

//01#####Ende INPUTS############################################ #############################

//02#####Beginn GLOBALE VARIABLEN######################################### ###################
//hier stehen die Variablen

//02#####Ende GLOBALE VARIABLEN######################################### ###################

//03#####INIT####################################### #######################################
int init()
{
IndicatorDigits(Digits);
IndicatorShortName("Scanner_kompakt"); //--- name for DataWindow and indicator subwindow label

//hier werden die Buffer definiert

return(INIT_SUCCEEDED);
}
//03#####Ende INIT############################################## ###########################

//04#####Beginn DEINIT############################################ #########################
int deinit()
{
return(0);
}
//04#####Ende DEINIT############################################ ###########################

//05#####Beginn START############################################# #########################
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int Counted_bars = IndicatorCounted();
int i=1;//Bars-Counted_bars-1; --> mich interessiert nur der Wert am letzten Bar
static datetime notification_time;

//Beginn Schleife--------------------------------------------
while(i>=0)
{
//...hier steht der eigentliche Code
ChartRedraw(0);
i--;
}

//Ende Ausgabe---------------------------------------------
return(rates_total);

}


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