Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 19.08.11
ATCDevil ATCDevil ist offline
Neues Mitglied
 
Registriert seit: Aug 2011
Beiträge: 1
ATCDevil befindet sich auf einem aufstrebenden Ast
Standard Hilfe mit SMAs und OBJ_VLINE

Hi zusammen,

ich bin ganz neu hier und mache meine ersten Schritte mit MQL.

Ich möchte einen Indicator schreiben, der die Postionen an denen sich 2 Durchschnitte kreuzen mit einer vertikalen Linie versieht... Wie könnte es am Ende des Scriptes aussehen?

//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
int Crossed (double line1 , double line2)
{
static int last_direction = 0;
static int current_direction = 0;

if(line1>line2)current_direction = 1; //up
if(line1<line2)current_direction = 2; //down


if (current_direction != last_direction) //changed
{
last_direction = current_direction;
return (last_direction);
}
else
{
return (0);
}
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
//----
int counted_bars=IndicatorCounted();
double shortSMA, longSMA;

//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;


shortSMA = iMA(NULL,0,8,0,0,0,0);
longSMA = iMA(NULL,0,21,0,0,0,0);

int isCrossed = Crossed(shortSMA,longSMA);

if (isCrossed == 1) //Blaue vertikale Linie;
if (isCrossed == 2) //Rote vertikale Linie;



Danke im Voraus für eure Mühen und euer Engagement!

Grüße