顺水外汇EA交易网MT4
标题:
520的牛版,我国外网站搞了个EA,分享到论坛,测试用不了...
[打印本页]
作者:
qq1850141942
时间:
2014-11-2 12:07
标题:
520的牛版,我国外网站搞了个EA,分享到论坛,测试用不了...
520的牛版,我国外网站搞了个EA,分享到论坛,测试用不了... 是不是MT4升级的原因,望纠正,造福需要的人 ~~~
//+------------------------------------------------------------------+
//| TakeProfit.mq4 |
//| Modded slightly by verbtheory for verbtheory's day break system |
//| Copyright ?2006, Taylor Stockwell |
//| stockwet@yahoo.com |
//| Version: 2.4 |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2006, Taylor Stockwell"
#property link "stockwet@yahoo.com"
/*
Updates:
11/2/2006:: Fixed bug that caused the sl var to be set to 1 when a pending
order was > than the First_Stop_Target value.
1/23/2007:: Fixed pip calculation. The old way of calculating pips could be
off by 1 pip, resulting in missed TP or move stops. The new
calculation is more accurate.
4/07/2009:: Adding trailing stop, enhancing shortly.
*/
//=============== VARS external
extern int First_Target = 50;
extern int Target_Increment = 25;
extern double Close_Lots = 0;
extern bool Move_Stops = true;
extern int First_Stop_Target = 80;
extern int First_Stop = 20;
extern int Second_Stop_Target = 350;
extern int Second_Stop = 200;
extern int Third_Stop_Target = 650;
extern int Third_Stop = 500;
extern int Fourth_Stop_Target = 2000;
extern int Fourth_Stop = 1500;
extern int Fifth_Stop_Target = 4000;
extern int Fifth_Stop = 3000;
extern bool Use_Max_Loss = true;
extern int Max_Loss = 350;
extern int Magic_Number=0;
//=============== VARS internal
int nextTP;
bool sl;
int range = 5;
int multiplier;
// OrderType == 1 is OP_SELL
//=============== FUNCTION init
int init()
{
sl=0;
nextTP = First_Target;
getMaxLoss();
}
//== end function
//=============== FUNCTION deinit
int deinit()
{
//----
sl=0;
nextTP = First_Target;
//----
return(0);
}
//== end function
//========== FUNCTION Start
int start()
{
//----
getOpenOrders();
getSpread();
//Comment(sl);
//----
return(0);
}
//== end function
//========== FUNCTION getPipValue
double getPipValue(double ord,int dir)
{
double val;
RefreshRates();
if(dir == 1) val=(NormalizeDouble(ord,Digits) - NormalizeDouble(Ask,Digits));
else val=(NormalizeDouble(Bid,Digits) - NormalizeDouble(ord,Digits));
val = val/Point;
return(val);
}
//== end function
int getSpread()
{
int spread=MarketInfo(Symbol(),MODE_SPREAD);
return(spread);
}
int getMaxLoss()
{
int calcMaxLoss;
calcMaxLoss = Max_Loss;
return(calcMaxLoss);
}
//========== FUNCTION getOpenOrders
void getOpenOrders()
{
int nsl, nsd;
string mngMagic;
int totalorders = OrdersTotal();
for(int j=0; j 0) killTrade(val,OrderTicket());
if(Move_Stops) checkStops(val,OrderTicket());
takeProfit(val,OrderTicket());
}
if(Magic_Number == 0)
mngMagic = "All "+Symbol()+" trades.";
else
mngMagic = "Trades with magic number = "+Magic_Number;
if(sl==0)
{
nsl = First_Stop_Target;
nsd = First_Stop;
}
else
{
nsl = Second_Stop_Target;
nsd = Second_Stop;
}
else
{
nsl = Third_Stop_Target;
nsd = Third_Stop;
}
else
{
nsl = Fourth_Stop_Target;
nsd = Fourth_Stop;
}
else
{
nsl = Fifth_Stop_Target;
nsd = Fifth_Stop;
}
//RefreshRates();
Comment("Order Open: ",OrderOpenPrice(),
"\nPip Count: ", val,
"\nNext Stop Target: ",nsl,
"\nNext Stop Differential: ", nsd,
"\nNext TP: ", nextTP,
"\nSL: ",sl,
"\nMax Loss: ", getMaxLoss(),
"\nManaging: ",mngMagic);
}
}
//========== FUNCTION takeProfit
void takeProfit(int pips, int ticket)
{
if(OrderSelect(ticket, SELECT_BY_TICKET)==true)
{
if(pips >= nextTP && pips = First_Stop_Target && pips = Second_Stop_Target)
{
if(pips >= Second_Stop_Target)
{
moveStops(ticket,Second_Stop);
}
}
else if(sl==2 || pips >= Third_Stop_Target)
{
if(pips >= Third_Stop_Target)
{
moveStops(ticket,Third_Stop);
}
}
else if(sl==3 || pips >= Fourth_Stop_Target)
{
if(pips >= Fourth_Stop_Target)
{
moveStops(ticket,Fourth_Stop);
}
}
else if(sl==4 || pips >= Fifth_Stop_Target)
{
if(pips >= Fifth_Stop_Target)
{
moveStops(ticket,Fifth_Stop);
}
}
}
//== end function
//========== FUNCTION moveStops
void moveStops(int ticket,int stopDiff)
{
if(OrderSelect(ticket, SELECT_BY_TICKET)==true)
{
Print("moveStops called ",ticket, " ",stopDiff);
if(OrderType()==1)
{
OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()-stopDiff*Point, OrderTakeProfit(),0,Plum);
sl=1;
}
else
{
OrderModify(ticket,OrderOpenPrice(),OrderOpenPrice()+stopDiff*Point, OrderTakeProfit(),0,Plum);
sl=1;
}
}
}
//== end function
//========== FUNCTION killTrades
void killTrade(int pips, int ticket)
{
if(OrderSelect(ticket, SELECT_BY_TICKET)==true)
{
if(pips <= -1*getMaxLoss())
{
if(OrderType()==1) OrderClose(ticket,OrderLots(),Ask,3,Red);
else OrderClose(ticket,OrderLots(),Bid,3,Red);
}
}
}
//== end function
作者:
qqqq1
时间:
2014-11-2 13:13
543543
作者:
阿新1
时间:
2014-11-2 14:21
。。。。。。。。。。。。。。。。。。。。。
作者:
KSXJM
时间:
2014-11-2 14:38
d'd'd'd'd'd'd'd'd'd'd'd'd'd'd
作者:
qwerdsa
时间:
2014-11-2 16:55
路过看看
....
作者:
ferrari0078
时间:
2014-11-3 08:31
路过看看
作者:
麒麟竭
时间:
2014-11-3 21:10
路过,飘过
作者:
qq1850141942
时间:
2014-11-4 08:42
路过看看
作者:
caonimagebi
时间:
2014-11-4 08:42
看了一眼,貌似是移动止损的EA,因为没看到发送订单的指令,而且if else那里也有些问题,可能是要修改修改。菜鸟一枚,错了见谅!
作者:
zehcoolb
时间:
2014-11-4 13:18
能改吗 改改呗 测试通过就行 这是非农拦截利润用的
作者:
qq1850141942
时间:
2014-11-4 13:18
就是那里搞的 不过 用不了 ,高手能改下吗?
作者:
sf928
时间:
2014-11-5 19:46
学习一下
作者:
qwerdsa520
时间:
2014-11-6 15:11
网上下载的EA,在MT4里的"编译"如出现错误,是运行不了的,如果是0错误,只有警告信息,还可以运行.本人在网上看到一个EA吹得天花乱坠,下载后测试不能运行,后用"编译"检查,竟发现九十多个错误!
作者:
solos
时间:
2014-11-8 16:16
路过看看
欢迎光临 顺水外汇EA交易网MT4 (http://www.waterforex.com/)
Powered by Discuz! X3.2