Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 17.05.12
klaus klaus ist offline
Neues Mitglied
 
Registriert seit: May 2012
Beiträge: 2
klaus befindet sich auf einem aufstrebenden Ast
Standard Bitte um Hilfe....

Hallo, bin neu im Forum-und noch "neuer" im erstellen von EA`s.

Mache im Moment meine ersten Gehversuche -bekomme aber das nachfolgende nicht compiliert(nicht erschrecken)
warscheinlich fast alles falsch??

Forex Expert Advisor Generator version 2.03 EA
//--------------------------------------------------------

#property copyright "Copyright © 2010, Forex EA Generator v2.03"
#property link "http://www.forexgenerator.com/"
#include <stdlib.mqh>

// exported variables
extern double BuyLots15 = 0.1;
extern int BuyStoploss15 = 20;
extern int BuyTakeprofit15 = 30;
extern double BuyLots12 = 0.1;
extern int BuyStoploss12 = 20;
extern int BuyTakeprofit12 = 30;
extern double SellLots16 = 0.1;
extern int SellStoploss16 = 20;
extern int SellTakeprofit16 = 30;


// local variables
double PipValue=1; // this variable is here to support 5-digit brokers
bool Terminated = false;
int Count13 = 0;


int init()
{

Comment(""); // clear the chart
}

// Expert start
int start()
{
if (Bars < 10)
{
Comment("Not enough bars");
return (0);
}
if (Terminated == true)
{
Comment("EA Terminated.");
return (0);
}

OnEveryTick14();

}

void OnEveryTick14()
{
if (true) PipValue = 10;
TechnicalAnalysis5();
PrintInfoToChart13();

}

void TechnicalAnalysis5()
{
if (iSAR(NULL, PERIOD_M15,0.03,0.2,0) > Open[0])
{
TechnicalAnalysis2x4();
IfOrderDoesNotExist9();

}
}

void TechnicalAnalysis2x4()
{
if ((iRVI(NULL, NULL,3,MODE_SIGNAL,0) > Open[0]) && (iCustom(NULL, PERIOD_M15, "Real_Woodie_CCI",3,2,27,26,10000,7,1,3,4,4,0) > Open[0]))
{
IfOrderDoesNotExist11();

}
}

void IfOrderDoesNotExist11()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}

if (exists == false)
{
BuyOrder15();

}
}

void BuyOrder15()
{

int ticket = OrderSend(Symbol(), OP_BUY, BuyLots15, Ask, 4, 0, 0, "My Expert", 1, 0, Blue);
if (ticket > -1)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - BuyStoploss15*PipValue*Point, Ask + BuyTakeprofit15*PipValue*Point, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));

}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}

void IfOrderDoesNotExist9()
{
bool exists = false;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 1)
{
exists = true;
}
}
else
{
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}

if (exists == false)
{
BuyOrder12();

}
}

void BuyOrder12()
{

int ticket = OrderSend(Symbol(), OP_BUY, BuyLots12, Ask, 4, 0, 0, "My Expert", 1, 0, Blue);
if (ticket > -1)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), Ask - BuyStoploss12*PipValue*Point, Ask + BuyTakeprofit12*PipValue*Point, 0, Blue);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
SellOrder16();

}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}

void SellOrder16()
{

int ticket = OrderSend(Symbol(), OP_SELL, SellLots16, Bid, 4, 0, 0, "My Expert", 1, 0, Red);
if (ticket > -1)
{
OrderSelect(ticket, SELECT_BY_TICKET);
bool ret = OrderModify(OrderTicket(), OrderOpenPrice(), Bid + SellStoploss16*PipValue*Point, Bid - SellTakeprofit16*PipValue*Point, 0, Red);
if (ret == false)
Print("OrderModify() error - ", ErrorDescription(GetLastError()));

}
else
{
Print("OrderSend() error - ", ErrorDescription(GetLastError()));
}
}

void PrintInfoToChart13()
{
string temp = "My EA\nExecuted : " + Count13 + "\n"
+ "Spread: " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)/PipValue, 2)+ "\n"
+ "------------------------------------------------\n"
+ "ACCOUNT INFORMATION:\n"
+ "\n"
+ "Account Name: " + AccountName()+ "\n"
+ "Account Leverage: " + DoubleToStr(AccountLeverage(), 0)+ "\n"
+ "Account Balance: " + DoubleToStr(AccountBalance(), 2)+ "\n"
+ "Account Equity: " + DoubleToStr(AccountEquity(), 2)+ "\n"
+ "Free Margin: " + DoubleToStr(AccountFreeMargin(), 2)+ "\n"
+ "Used Margin: " + DoubleToStr(AccountMargin(), 2)+ "\n"
+ "------------------------------------------------\n";
Comment(temp);
Count13++;

}



int deinit()
{

}