比特币通信协议 - 币圈消息

比特币通信协议篇11、二、TURN简介。在典型的情况下,TURN客户端连接到内网中,并且通过一个或者多个NAT到 详细

求趨勢線突破下單的EA

  [复制链接]
1034 16
hxh200 发表于 2018-1-11 00:54:33 | 只看该作者 |阅读模式 打印 上一主题 下一主题
本論壇                                                  
收藏
收藏0
转播
转播
分享
分享
分享
淘帖0

精彩评论16

跳转到指定楼层
沙发
薇心思雨狮子头 发表于 2018-1-11 01:50:32 | 只看该作者
编译不通过 呢,好多错误
板凳
stonedagain 发表于 2018-1-11 02:10:23 | 只看该作者
520 有你更精彩!
地板
zhao543 发表于 2018-1-11 03:43:33 | 只看该作者
有道理,看看楼主分享了什么好EA?
5#
 楼主| hxh200 发表于 2018-1-11 05:17:42 | 只看该作者
沒人理,只好自己寫,寫好了,有誰要?
6#
flower708 发表于 2018-1-11 05:53:49 | 只看该作者
沒人理,只好自己寫
7#
 楼主| hxh200 发表于 2018-1-11 06:04:38 | 只看该作者

                                       extern string __MAIN_FUNCTIONS_____;
extern int Slippage = 3;
extern int MagicNumber = 1803;
extern int Risk_percent = 5;
extern double minLots = 0.1;
extern double maxLots = 5;
extern string __TP\SL_FUNCTION_____;
extern double StopLoss = 250;
extern double TakeProfit = 1500;
extern string __MOVE_STOPS_FUNCTION_____;
extern bool Move_Stops = true;
extern int First_Stop_Target = 250;
extern int First_Stop = 50;
extern int Second_Stop_Target = 500;
extern int Second_Stop = 250;
extern int Third_Stop_Target = 750;
extern int Third_Stop = 500;
extern int Fourth_Stop_Target = 1000;
extern int Fourth_Stop = 750;
extern int Fifth_Stop_Target = 1250;
extern int Fifth_Stop = 1000;
extern string __TRADING_HOURS_LIMIT_____;
extern int iStartTradingHour = 0;
extern int iEndTradingHour = 24;
extern string __MA_TREND_FILTER_____;
extern int maPeriod = 50;
extern string __BOLINGER_BANDS_TRIG_____;
extern int BBperiod = 20;
extern string __MAIN_FILTERS_____;
extern int MACD_Fast = 8;
extern int MACD_Slow = 17;
extern int MACD_Signal = 9;
extern int RSI = 9;
extern int Momentum = 14;
extern int DeMarker = 14;
extern int ADX = 14;
extern int ForceIndex = 14;
//+-------------------------------------------------------------------------------------------+
double BBUPPER;
double BBLOWER;
double CCI;
//----
double MACD;
double MACD_Sig;
//----
double ADX1;
double ADX2;
//----
double RSIV;
double DEM;
double MOM;
double FI;
int Buy_signal1=0;
int StartHour = 0;
double Lots=0.1;
int Bar_Count=0;
extern int OrderRetries = 5;
extern int SleepBetweenTrades = 1000;
int ticket_buy;
int ticket_sell;
string strSymbol;
string strComment="FXParazite by FOREXflash";
color BuyArrow=Blue;
color SellArrow=Red;
string only_demo_accounts = "";
int Prev_Order=-1;
datetime Check_period=0;
datetime Checked_period=0;
bool longs=true;
bool shorts=true;
bool result =false;
string trendType;
int timeFrame = 0;
int nextTP;
bool sl;
int range = 5;
int multiplier;
//+-------------------------------------------------------------------------------------------+
//| expert initialization function |
//+-------------------------------------------------------------------------------------------+
int init()
{
//----
sl=0;
ObjectCreate("lblTrendType",OBJ_LABEL,0,0,0,0,0);
ObjectSet("lblTrendType",OBJPROP_XDISTANCE,5);
ObjectSet("lblTrendType",OBJPROP_YDISTANCE,100);
ObjectSetText("lblTrendType","TrendType",14,"Tahoma",Red);
//----
return(0);
}
//+-------------------------------------------------------------------------------------------+
//| expert deinitialization function |
//+-------------------------------------------------------------------------------------------+
int deinit()
{
//----
sl=0;
// ObjectsDeleteAll();
//----
return(0);
}
//+-------------------------------------------------------------------------------------------+
//| Trend analize |
//+-------------------------------------------------------------------------------------------+
void MarketAnalize()
{
double ma = iMA(Symbol(),0,maPeriod,0,MODE_EMA,PRICE_OPEN,0);
if(Open[0]>ma)
{
trendType = "Bullish";
}
if(Open[0]70 && ma > Ask) && (CCI>100) &&(MOM > 100) && (DEM > 0.5 && FI >0) && (MACD > MACD_Sig && ADX1 > ADX2)) return (1);
if ( (RSI0 1)
{
if(OrdersTotal()4)EndSession();
}
}
MarketAnalize();
getOpenOrders();
getSpread();
FILTERS();
double BBUPPER =iBands(NULL,0,BBperiod,3,0,PRICE_CLOSE,MODE_UPPER,1);
double BBLOWER =iBands(NULL,0,BBperiod,3,0,PRICE_CLOSE,MODE_LOWER,1);
//+-------------------------------------------------------------------------------------------+
int i=0,k=0,sec=0;
int Insider, Insider2;
int Black_insider, White_insider, White_bird, Black_bird;
int Buy_signal=0;
int Confirm_buy;
int Confirm_sell;
int Sell_signal=0;
int Downer=0;
int Upper=0;
double Zig_level_buy;
double Zig_level_sell;
string i_n;
string loss_filename, win_filename, month, day, ticket_id;
double max_price;
double min_price;
strSymbol=Symbol();
// Defining the variables to decide.
if (High[1]=Low[2] && Close[1]=High[2] && Low[1]=Open[1]) White_insider=1;
else White_insider=0;
if (White_insider==1 && Close[2]>Open[2]) White_bird=1;
else White_bird=0;
if (Black_insider==1 && Close[2]Close[1]) {Zig_level_sell=(Close[1]+(Open[1]-Close[1])/3);}//Black
else {Zig_level_sell=(Close[1]+(High[1]-Close[1])/3);}//White
if ( ((Low[0]=StartHour)) &&(Black_bird==0) && (White_insider==0))
Confirm_buy=1;
else Confirm_buy=0;
if ( ((High[0]>=Zig_level_sell) || (Hour()>=StartHour)) && (White_bird==0) && (Black_insider==0))
Confirm_sell=1;
else Confirm_sell=0;
if (High[0]>High[1]) Buy_signal=1; else Buy_signal=0;
if (Buy_signal==1)
{
i++;
max_price=High;
while (max_priceLow[k+1])
{
min_price=Low[k+1];
k++;
}
}
//+-------------------------------------------------------------------------------------------+
//| expert buy |
//+-------------------------------------------------------------------------------------------+
if (Buy_signal==1)
{
Call_MM();
if (longs==false&&iVolume(Symbol(),0,0)= iEndTradingHour) return;
if (Confirm_buy==1)
if (OpenTradesForMN(MagicNumber)==0)
if (trendType=="Bullish")
if (High[1]>=BBUPPER)
if (FILTERS() == 1)
{
ticket_sell=OpenAtMarket(strSymbol,OP_SELL,Lots,StopLoss,TakeProfit,strComment,MagicNumber,0,SellArrow, OrderRetries, SleepBetweenTrades);
OrderSend(Symbol(),OP_SELLSTOP,Lots,Ask-Second_Stop*Point,2,Ask-Second_Stop*Point + StopLoss * Point,Bid - TakeProfit * Point,DoubleToStr(Ask,MarketInfo(Symbol(),MODE_DIGITS)),MagicNumber,0,Red);
OrderSend(Symbol(),OP_SELLSTOP,Lots,Ask-Third_Stop*Point,2,Ask-Third_Stop*Point + StopLoss * Point,Bid - TakeProfit * Point,DoubleToStr(Ask,MarketInfo(Symbol(),MODE_DIGITS)),MagicNumber,0,Red);
OrderSend(Symbol(),OP_SELLSTOP,Lots,Ask-Fourth_Stop*Point,2,Ask-Fourth_Stop*Point + StopLoss * Point,Bid - TakeProfit * Point,DoubleToStr(Ask,MarketInfo(Symbol(),MODE_DIGITS)),MagicNumber,0,Red);
longs = false;
if (StringLen(DoubleToStr(ticket_buy,0))==1) ticket_id="0"+ticket_buy;
else ticket_id=ticket_buy;
Prev_Order=1;
}
}
//+-------------------------------------------------------------------------------------------+
//| expert sell |
//+-------------------------------------------------------------------------------------------+
if (Sell_signal==1)
{
Call_MM();
if (shorts==false&&iVolume(Symbol(),0,0)= iEndTradingHour) return;
if (Confirm_sell==1)
if (OpenTradesForMN(MagicNumber)==0)
if (trendType=="Bearish")
if (Low[1]0)
{
RefreshRates();
if(iOrderType==OP_BUY)
{
dPrice=NormalizeDouble(Ask, Digits);
dSL=NormalizeDouble(dPrice-iStopLossPips*Point, Digits);
dTP=NormalizeDouble(dPrice+iTakeProfitPips*Point, Digits);
}
if(iOrderType==OP_SELL)
{
dPrice=NormalizeDouble(Bid, Digits);
dSL=NormalizeDouble(dPrice+iStopLossPips*Point, Digits);
dTP=NormalizeDouble(dPrice-iTakeProfitPips*Point, Digits);
}
int iTicket = OrderSend(strPair, iOrderType, dLots, dPrice, Slippage, dSL, dTP, strOrderComment, iMagicNumber, dtExpiry, cColour);
iNumRetries--;
if(iTicket == -1 )
{
int iError = GetLastError();
// retry if error is "busy", otherwise give up
if(iError==ERR_SERVER_BUSY || iError==ERR_TRADE_CONTEXT_BUSY || iError==ERR_BROKER_BUSY || iError==ERR_NO_CONNECTION
|| iError==ERR_TRADE_TIMEOUT || iError==ERR_INVALID_PRICE || iError==ERR_OFF_QUOTES || iError==ERR_PRICE_CHANGED || iError==ERR_REQUOTE)
Sleep(iMTS);
else
{
iNumRetries = 0;
Print("OpenAtMarket: OrderSend Error ", iError );
}
}
else
iNumRetries = 0;
}
return(iTicket);
}
//+-------------------------------------------------------------------------------------------+
//| call moneymanagment |
//+-------------------------------------------------------------------------------------------+
void Call_MM()
{
Lots=AccountFreeMargin()/100000*Risk_percent;
Lots=MathMin(maxLots,MathMax(minLots,Lots));
if(minLots<0.1)
Lots=NormalizeDouble(Lots,2);
else
{
if(minLots<1) Lots=NormalizeDouble(Lots,1);
else Lots=NormalizeDouble(Lots,0);
}
return(0);
}
//+-------------------------------------------------------------------------------------------+
//| trail jumps |
//+-------------------------------------------------------------------------------------------+
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);
}
//========== FUNCTION getOpenOrders
void getOpenOrders()
{
int nsl, nsd;
string mngMagic;
int totalorders = OrdersTotal();
for(int j=0; j<totalorders;j++)
{
OrderSelect(j, SELECT_BY_POS, MODE_TRADES);
if((OrderType() == OP_BUY || OrderType() == OP_SELL) && OrderSymbol() == Symbol()&&(MagicNumber==0 || MagicNumber == OrderMagicNumber()))
{
double val=getPipValue(OrderOpenPrice(),OrderType());
if(Move_Stops) checkStops(val,OrderTicket());
}
if(MagicNumber == 0)
mngMagic = "All "+Symbol()+" trades.";
else
mngMagic = "Trades with magic number = "+MagicNumber;
if(sl==0)
{
nsl = First_Stop_Target;
nsd = First_Stop;
}
else
{
nsl = Second_Stop_Target;
nsd = Second_Stop;
}
//RefreshRates();
Comment("Order Open: ",OrderOpenPrice(),
"\nPip Count: ", val,
"\nNext Stop Target: ",nsl,
"\nNext Stop Differential: ", nsd,
"\nNext TP: ", nextTP,
"\nSL: ",sl,
"\nManaging: ",mngMagic);
}
}
//========== FUNCTION moveStops
        
8#
资治通鉴 发表于 2018-1-11 07:08:51 | 只看该作者
好好学习天天向上!
9#
人民币 发表于 2018-1-11 07:56:05 | 只看该作者


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
10#
Atom 发表于 2018-1-11 08:57:41 | 只看该作者
【 趨勢線突破下單的EA 】,有源码,呵呵
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

发布主题
阅读排行更多+

Powered by 顺水鱼MT4外汇EA网! X3.2© 2001-2017 顺水MT4外汇EA公司.( 陕ICP备17014341号-1