Zitat:
Zitat von Deepack
und?
hat schon jemand gute erfahrungen mit der strategie gemacht?
ich habe nur kurz einen EA geschrieben
der eine linie auf den chart zeichnet wenn die Regeln zutreffen
jedoch scheint diese strategie meist im verlust zu enden
was meint ihr dazu?
code vom EA
(ist nur ein erster versuch gewesen
bin über ideen und verbesserungen erfreut)
Code:
extern string IIIIIIIIIIIIIIIIIIIIII=">>>>>>>> Indicator Settings <<<<<<<<";
extern int MA1_Period =10;
extern int MA2_Period =13;
extern int MA3_Period =20;
extern int MA4_Period =50;
extern int Tolleranz =100;
//--------------------------------------------------------------------//
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
double MA1 = iMA(NULL,0,MA1_Period,0,0,0,0);
double MA2 = iMA(NULL,0,MA2_Period,0,0,0,0);
double MA3 = iMA(NULL,0,MA3_Period,0,0,0,0);
double MA4 = iMA(NULL,0,MA4_Period,0,0,0,0);
//LongPositionen
if (MA1 > MA2 && MA2 > MA3 && MA3 > MA4 && iClose(Symbol(),0,1) > MA4 && iOpen(Symbol(),0,1) > MA4)
{
if (iOpen(Symbol(),0,0) > MA2 && iOpen(Symbol(),0,0) < MA1 + Tolleranz * Point)
{
ObjectCreate("line"+MA1, OBJ_VLINE, 0, Time[0], 0);
ObjectSet("line"+MA1, OBJPROP_COLOR, Green);
}
}
if (MA1 < MA2 && MA2 < MA3 && MA3 < MA4 && iClose(Symbol(),0,1) < MA4 && iOpen(Symbol(),0,1) < MA4)
{
if (iClose(Symbol(),0,0) < MA2 && iClose(Symbol(),0,0) > MA1 - Tolleranz * Point)
{
ObjectCreate("line"+MA1, OBJ_VLINE, 0, Time[0], 0);
ObjectSet("line"+MA1, OBJPROP_COLOR, Red);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
|
Versuch es mal so. Du müsstest die Entstehung der Kerze abwarten entsprechnd der eingstellten Periode. Und nicht vergessen ob 4- oder 5-digit Broker etc...
[
Code:
extern string IIIIIIIIIIIIIIIIIIIIII=">>>>>>>> Indicator Settings <<<<<<<<";
extern int MA1_Period =10;
extern int MA2_Period =13;
extern int MA3_Period =20;
extern int MA4_Period =50;
extern int Tolleranz =100;
//--------------------------------------------------------------------//
int gtimeframe = 0;
static datetime update = 0;
double gpointvalue = 0;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
gtimeframe = Period();
if (Digits == 4 || Digits == 2) gpointvalue = Point;
else if (Digits == 5 || Digits == 3) gpointvalue = 10.0 * Point;
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if(update == 0 || TimeLocal() > update + gtimeframe * 60)
{
double MA1 = iMA(NULL,0,MA1_Period,0,0,0,0);
double MA2 = iMA(NULL,0,MA2_Period,0,0,0,0);
double MA3 = iMA(NULL,0,MA3_Period,0,0,0,0);
double MA4 = iMA(NULL,0,MA4_Period,0,0,0,0);
//LongPositionen
if (MA1 > MA2 && MA2 > MA3 && MA3 > MA4 && iClose(Symbol(),0,1) > MA4 && iOpen(Symbol(),0,1) > MA4)
{
if (iOpen(Symbol(),0,0) > MA2 && iOpen(Symbol(),0,0) < MA1 + Tolleranz * gpointvalue)
{
ObjectCreate("line"+MA1, OBJ_VLINE, 0, Time[0], 0);
ObjectSet("line"+MA1, OBJPROP_COLOR, Green);
}
}
if (MA1 < MA2 && MA2 < MA3 && MA3 < MA4 && iClose(Symbol(),0,1) < MA4 && iOpen(Symbol(),0,1) < MA4)
{
if (iClose(Symbol(),0,0) < MA2 && iClose(Symbol(),0,0) > MA1 - Tolleranz * gpointvalue)
{
ObjectCreate("line"+MA1, OBJ_VLINE, 0, Time[0], 0);
ObjectSet("line"+MA1, OBJPROP_COLOR, Red);
}
}
update = TimeLocal()- TimeLocal()%gtimeframe;
}
//----
return(0);
}
//+------------------------------------------------------------------+
|