Thema: TMAslope
Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 10.10.16
Sacred Sacred ist offline
Neues Mitglied
 
Registriert seit: Sep 2016
Beiträge: 1
Sacred befindet sich auf einem aufstrebenden Ast
Standard TMAslope

Hi @ all,

habe diesen EA im Internet gefunden und hab ihn versucht zum laufen zu bekommen, leider finde ich den Fehler nicht. Hat einer von euch eine Idee dazu.
Datein im Anhang.

Code:


string gs76 = "www.vikrav.com BreakEven";
extern int LockInPipsAt = 16;
extern int LockInPips = 5;
extern int Trades = 1;
extern bool ModifyTrades = FALSE;
extern bool ModifyTrade3 = FALSE;
extern int FontSize = 8;
extern color FontColour = White;
double gdunused112;
double gd120;
double gd128;
string gs144 = "expert.wav";
string gsdummy152;
int gi160 = 3;
int gslippage164 = 0;
int gi168 = 0;


extern int MagicNumber=50;
extern double Lots =0.1;
extern double StopLoss=25;
extern double TakeProfit=53;
extern int TrailingStop=0;
extern int Slippage=3;

int init() {
gd120 = Point;
gdunused112 = Digits;
gslippage164 = gi160;
if (Digits == 5 || Digits == 3) {
gdunused112 = Digits - 1;
gd120 = 10.0 * Point;
gslippage164 = 10 * gi160;
}
if (NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2) == 0.01) gi168 = 2;
else gi168 = 1;
if (Trades > 3) Trades = 3;
if (Trades < 1) Trades = 1;
ObjectCreate("EA_Version", OBJ_LABEL, 0, 0, 0);
ObjectSetText("EA_Version", gs76 + " - Lock in " + LockInPips + " pips after " + LockInPipsAt + " pips profit", FontSize, "Arial Bold", FontColour);
ObjectSet("EA_Version", OBJPROP_XDISTANCE, 240);
ObjectSet("EA_Version", OBJPROP_YDISTANCE, 0);
if (Trades > 1) {
ObjectCreate("Monitor1", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Monitor1", "Monitoring Targets: TP1=" + LockInPipsAt + " Pips", FontSize, "Arial Bold", FontColour);
ObjectSet("Monitor1", OBJPROP_CORNER, 0);
ObjectSet("Monitor1", OBJPROP_XDISTANCE, 240);
ObjectSet("Monitor1", OBJPROP_YDISTANCE, FontSize + 5);
}
if (Trades > 1) {
ObjectCreate("Monitor2", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Monitor2", "|| TP2=" + (LockInPipsAt * 2) + " Pips", FontSize, "Arial Bold", FontColour);
ObjectSet("Monitor2", OBJPROP_CORNER, 0);
ObjectSet("Monitor2", OBJPROP_XDISTANCE, 455);
ObjectSet("Monitor2", OBJPROP_YDISTANCE, FontSize + 5);
}
if (Trades == 3) {
ObjectCreate("Monitor3", OBJ_LABEL, 0, 0, 0);
ObjectSetText("Monitor3", "|| TP3=" + (3 * LockInPipsAt) + " Pips", FontSize, "Arial Bold", FontColour);
ObjectSet("Monitor3", OBJPROP_CORNER, 0);
ObjectSet("Monitor3", OBJPROP_XDISTANCE, 555);
ObjectSet("Monitor3", OBJPROP_YDISTANCE, FontSize + 5);
}
return (0);
}

int deinit() {
ObjectDelete("EA_Version");
ObjectDelete("Monitor1");
ObjectDelete("Monitor2");
ObjectDelete("Monitor3");
return (0);
}

//+------------------------------------------------------------------+
// expert start function
//+------------------------------------------------------------------+


int start()
{
double MyPoint=Point;
if(Digits==3 || Digits==5) MyPoint=Point*10;

double TheStopLoss=0;
double TheTakeProfit=0;
if( TotalOrdersCount()==0 )
{
int result=0;
if(iCustom(NULL,0,"TMAtrue","Select below 0=current tf,1,5,15,30,60,240,1440,10080,43200",0,5,42,"Verd ana",12,3,clrWhite,clrGreen,clrRed,20,0.4,-0.4,100,5,22,3,12,12,5,2,3,0,0)>0.4) // Here is your open buy rule
{
result=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage ,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue);
if(result>0)
{
TheStopLoss=0;
TheTakeProfit=0;
if(TakeProfit>0) TheTakeProfit=Ask+TakeProfit*MyPoint;
if(StopLoss>0) TheStopLoss=Ask-StopLoss*MyPoint;
OrderSelect(result,SELECT_BY_TICKET);
OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(TheStopLoss,Digits),NormalizeDouble(TheTa keProfit,Digits),0,Green);
}
return(0);
}
if(iCustom(NULL,0,"TMAtrue","Select below 0=current tf,1,5,15,30,60,240,1440,10080,43200",0,5,42,"Verd ana",12,3,clrWhite,clrGreen,clrRed,20,0.4,-0.4,100,5,22,3,12,12,5,2,3,0,0)<-0.4) // Here is your open Sell rule
{
result=OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippag e,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Red);
if(result>0)
{
TheStopLoss=0;
TheTakeProfit=0;
if(TakeProfit>0) TheTakeProfit=Bid-TakeProfit*MyPoint;
if(StopLoss>0) TheStopLoss=Bid+StopLoss*MyPoint;
OrderSelect(result,SELECT_BY_TICKET);
OrderModify(OrderTicket(),OrderOpenPrice(),Normali zeDouble(TheStopLoss,Digits),NormalizeDouble(TheTa keProfit,Digits),0,Green);
}
return(0);
}
}

for(int cnt=0;cnt<OrdersTotal();cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if(OrderType()<=OP_SELL &&
OrderSymbol()==Symbol() &&
OrderMagicNumber()==MagicNumber
)
{
if(OrderType()==OP_BUY)
{
if((iMA(NULL,0,8,0,MODE_EMA,PRICE_CLOSE,0)<iMA(NUL L,0,20,0,MODE_EMA,PRICE_CLOSE,0))) //here is your close buy rule
{
OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),Slippage,Red);
}
if(TrailingStop>0)
{
if(Bid-OrderOpenPrice()>MyPoint*TrailingStop)
{
if(OrderStopLoss()<Bid-MyPoint*TrailingStop)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-TrailingStop*MyPoint,OrderTakeProfit(),0,Green);
return(0);
}
}
}
}
else
{
if((iMA(NULL,0,8,0,MODE_EMA,PRICE_CLOSE,0)>iMA(NUL L,0,20,0,MODE_EMA,PRICE_CLOSE,0))) // here is your close sell rule
{
OrderClose(OrderTicket(),OrderLots(),OrderClosePri ce(),Slippage,Red);
}
if(TrailingStop>0)
{
if((OrderOpenPrice()-Ask)>(MyPoint*TrailingStop))
{
if((OrderStopLoss()>(Ask+MyPoint*TrailingStop)) || (OrderStopLoss()==0))
{
OrderModify(OrderTicket(),OrderOpenPrice(),Ask+MyP oint*TrailingStop,OrderTakeProfit(),0,Red);
return(0);
}
}
}
}
}
}
if (Digits == 5 || Digits == 3) gd128 = MarketInfo(Symbol(), MODE_SPREAD) / 10.0;
else gd128 = MarketInfo(Symbol(), MODE_SPREAD);
if (LockInPipsAt > 0) {
for (int lpos0 = 0; lpos0 < OrdersTotal(); lpos0++) {
OrderSelect(lpos0, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol()) {
switch (OrderType()) {
case OP_BUY:
if (iClose(OrderSymbol(), 0, 0) - OrderOpenPrice() >= LockInPipsAt * gd120) {
if (OrderStopLoss() < OrderOpenPrice()) {
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + LockInPips * gd120, OrderTakeProfit(), 0, CLR_NONE);
Print("Stop Loss adjusted to ", LockInPips, " pips");
PlaySound(gs144);
if (Trades > 1) {
OrderClose(OrderTicket(), NormalizeDouble(OrderLots() / Trades, gi168), Bid, gslippage164, CLR_NONE);
Print("Partial order closed to lock in profits by Breakeven EA");
}
}
}
if (Trades == 3 && ModifyTrades && iClose(OrderSymbol(), 0, 0) - OrderOpenPrice() >= LockInPipsAt * 2 * gd120) {
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + LockInPipsAt * gd120, OrderTakeProfit(), 0, CLR_NONE);
Print("Stop Loss adjusted to ", LockInPipsAt, " pips");
Sleep(500);
OrderClose(OrderTicket(), NormalizeDouble(OrderLots() / 2.0, gi168), Bid, gslippage164, CLR_NONE);
Print("Partial order closed to lock in profits");
ModifyTrades = FALSE;
PlaySound(gs144);
}
if (Trades == 3 && ModifyTrade3 && iClose(OrderSymbol(), 0, 0) - OrderOpenPrice() >= 3 * LockInPipsAt * gd120) {
OrderClose(OrderTicket(), OrderLots(), Bid, gslippage164, CLR_NONE);
Print("Final Order closed by Breakeven EA");
ModifyTrade3 = FALSE;
PlaySound(gs144);
}
break;
case OP_SELL:
if (OrderOpenPrice() - iClose(OrderSymbol(), 0, 0) >= LockInPipsAt * gd120) {
if (OrderStopLoss() > OrderOpenPrice()) {
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - LockInPips * gd120, OrderTakeProfit(), 0, Yellow);
Print("Stop Loss adjusted to ", LockInPips, " pips");
PlaySound(gs144);
if (Trades > 1) {
OrderClose(OrderTicket(), NormalizeDouble(OrderLots() / Trades, gi168), Ask, gslippage164, CLR_NONE);
Print("Partial order closed to lock in profits by Breakeven EA");
}
}
}
if (Trades == 3 && ModifyTrades && OrderOpenPrice() - iClose(OrderSymbol(), 0, 0) >= LockInPipsAt * 2 * gd120) {
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - LockInPipsAt * gd120, OrderTakeProfit(), 0, CLR_NONE);
Print("Stop Loss adjusted to ", LockInPipsAt, " pips");
Sleep(500);
OrderClose(OrderTicket(), NormalizeDouble(OrderLots() / 2.0, gi168), Ask, gslippage164, CLR_NONE);
Print("Partial order closed to lock in profits by Breakeven EA");
ModifyTrades = FALSE;
PlaySound(gs144);
}
if (Trades == 3 && ModifyTrade3 && OrderOpenPrice() - iClose(OrderSymbol(), 0, 0) >= 3 * LockInPipsAt * gd120) {
OrderClose(OrderTicket(), OrderLots(), Ask, gslippage164, CLR_NONE);
Print("Final Order closed by Breakeven EA");
ModifyTrade3 = FALSE;
PlaySound(gs144);
}
}
}
}
}
return(0);
}

int TotalOrdersCount()
{
int result=0;
for(int i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS ,MODE_TRADES);
if (OrderMagicNumber()==MagicNumber) result++;

}
return (result);
}
Angehängte Dateien
Dateityp: ex4 TMAtrue.ex4 (24,8 KB, 2x aufgerufen)
Dateityp: mq4 TMAtrue.mq4 (9,7 KB, 4x aufgerufen)
Dateityp: ex4 TMAslope.ex4 (19,2 KB, 1x aufgerufen)
Dateityp: mq4 TMAslope.mq4 (9,9 KB, 5x aufgerufen)