您需要 登录 才可以下载或查看,没有帐号?注册
cci指标我就改了个时间参数,然后就不开仓了 源码在这:
extern int magic=1234; // magic number required if you use different settings on a same pair, same timeframe
extern string moneymanagement= Money Management
extern double lots=0.1; // lots size
extern bool mm=true; // enable risk management
extern int mmmode=0; // 0=freemargin, 1=equity, 2=balance
extern double longrisk=0.24; // risk in percentage of the account
extern double shortrisk=0.24; // risk in percentage of the account
extern double minlot=0.01; // minimum lots size
extern double maxlot=100; // maximum lots size
extern double lotdigits=2; // lot digits, 1 for mini, 2 for micro
//extern bool martingale=false; // enable the martingale
//extern double multiplier=2.0; // multiplier used for the martingale
//extern bool basketpercent=false; // enable the basket percent
//extern double profit=10; // close all orders if a profit of 10 percents has been reached
//extern double loss=30; // close all orders if a loss of 30 percents has been reached
extern string ordersmanagement= Order Management
extern bool ecn=false; // make the expert compatible with ecn brokers
extern bool oppositeclose=false; // close the orders on an opposite signal
extern bool reversesignals=false; // reverse the signals, long if short, short if long
extern int maxtrades=100; // maximum trades allowed by the traders
extern int tradesperbar=1; // maximum trades per bar allowed by the expert
extern bool hidesl=false; // hide stop loss
extern bool hidetp=false; // hide take profit
extern double stoploss=0; // stop loss
extern double takeprofit=0; // take profit
extern double trailingstart=0; // profit in pips required to enable the trailing stop
extern double trailingstop=0; // trailing stop
extern double trailingprofit=0; // trailing profit
extern double trailingstep=1; // margin allowed to the market to enable the trailing stop
extern double breakevengain=0; // gain in pips required to enable the break even
extern double breakeven=0; // break even
int expiration=0; // expiration in minutes for pending orders
double slippage=0; // maximum difference in pips between signal and order
extern double maxspread=100; // maximum spread allowed by the expert
extern string entrylogics= Entry Logics
extern int longpercci=90;(这里原值是24)
extern int longsensitivity=10;
extern double longlotsincrement=0.01;
extern int longtargetpips=25;
extern double longtargetpct=0.085;
extern int shortpercci=90;(这里原值是24)
extern int shortsensitivity=10;
extern double shortlotsincrement=0.01;
extern int shorttargetpips=25;
extern double shorttargetpct=0.085;
extern int shift=1; // bar in the past to take in consideration for the signal
extern string comment= EA // comment to display in the order
int i,bc=-1,lastorder,buyorderprofit,sellorderprofit;
int nstarthour,nendhour,nfridayhour,tpb,tps,cnt,ticket,number,tries=100;
double lastbuyopenprice,lastsellopenprice,lastbuyprofit,lastsellprofit;
double cb,sl,tp,ilots,lastbuylot,lastselllot,lastlot,lastprofit,mlots,buypips,sellpips;
string istarthour,istartminutes,iendhour,iendminutes,ifridayhour,ifridayminutes;
datetime t0,t1,tstart,tend,tfriday,lastbuyopentime,lastsellopentime;
double pt,mt;
int dg;
int init(){
t0=Time[0];
t1=Time[0];
dg=Digits;
if(dg==3 || dg==5){pt=Point*10;mt=10;}else{pt=Point;mt=1;}
return(0);
}
int start(){
if(breakevengain 0)movebreakeven(breakevengain,breakeven);
if(trailingstop 0)movetrailingstop(trailingstart,trailingstop);
if(trailingprofit 0)movetrailingprofit(trailingstart,trailingprofit);
//if(basketpercent)closebasketpercent(profit,loss);
if((Ask-Bid) maxspread*mt*pt)return(0);
if((count(OP_BUY)+count(OP_SELL)) =maxtrades)return(0);
int expire=0;
if(expiration 0)expire=TimeCurrent()+(expiration*60)-5;
ticket=0;
number=0;
if(buy tpb=0))*/)lots=longlotsoptimized();
if(lastbuyopenprice!=0)ilots=lots+NormalizeDouble(longlotsincrement*NormalizeDouble((MathAbs(lastbuyopenprice-Ask)/pt)/longsensitivity,0),lotdigits);else ilots=lots;
if(ecn==false){
while(ticket=takeprofit*OrderLots()*10)){
OrderClose(OrderTicket(),OrderLots(),Bid,slippage*mt);
}
}
}
}
void hideclosesell(){
RefreshRates();
if(OrdersTotal() 0){
for(i=OrdersTotal();i i--){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol() OrderMagicNumber()==magic OrderType()==OP_SELL
(hidesl stoploss 0 OrderProfit()0 OrderProfit() =takeprofit*OrderLots()*10)){
OrderClose(OrderTicket(),OrderLots(),Ask,slippage*mt);
}
}
}
}
//|---------breakeven
void movebreakeven(double breakevengain,double breakeven){
RefreshRates();
if(OrdersTotal() 0){
for(i=OrdersTotal();i i--){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()=NormalizeDouble(breakevengain*pt,dg)){
if((NormalizeDouble((OrderStopLoss()-OrderOpenPrice()),dg)=NormalizeDouble(breakevengain*pt,dg)){
if((NormalizeDouble((OrderOpenPrice()-OrderStopLoss()),dg)0){
for(i=OrdersTotal();i i--){
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderType()NormalizeDouble(OrderOpenPrice()+trailingstart*pt,dg)
NormalizeDouble(OrderStopLoss(),dg)
外汇交易有很大的风险性,本站所有资源均来自网络,请选择使用,如若出现亏损,本站不承担任何责任!