FM-CONECTION

FM-CONECTION

官方版 无广告 34

更新日期:2022-11-08 分类标签: 语言:中文 平台:没限制

4 人已下载 手机查看

FM-CONECTION

//+------------------------------------------------------------------+
//| FM-CONECTION.mq4 |
//| FxMoment |
//| https://fxmoment.ru |
//+------------------------------------------------------------------+
#property copyright "FxMoment"
#property link "https://fxmoment.ru"
//-----------------------相疣戾蝠?-----------------------------------+
extern string c0="------------------------";
extern double Risk =1; //需耜, 腩??镳铞屙蜞?
extern double MaxRisk =5; //锑犟桁嚯 痂耜 (羼腓 玎溴轳蜮钼囗?耧铐屙蜞)
extern double ProfitProcent =0.2; //羽钼屙?蝈殛 镳铘栩??镳铞屙蜞?磬 赅驿 铗瘥螓?铕溴?
extern double ProfitProcentPachka =15; //羽钼屙?蝈殛 镳铘栩??镳铞屙蜞?镱 钺?镳栳?
extern double StopMinus =20; //锑犟桁嚯 疣珈屦 筢赅 ?镳铞屙蜞?
extern string c1="------------------------";
extern double UpLot =1; //羊屣屙?筲咫梓屙? 腩蜞 (耧铐屙蜞)
extern int Step =5; //剜?皴蜿?
extern int MaxOrders =30; //锑犟桁嚯铄 觐腓麇耱忸 铕溴痤??皴蜿?镱 赅驿铋 镟疱
extern bool Doliv =true; //玛膻鬣蝈朦 皴蜿?铕溴痤??镫
extern string c2="------------------------";
extern int TimeStart =1; //吗屐 磬鬣豚 疣犷螓
extern int TimeEnd =9; //吗屐 铌铐鬣龛 疣犷螓
extern string c3="------------------------";
extern int TimeClose =10; //吗屐 潆 耱囵蜞 玎牮? ?筢铌
extern double ProfitTimeClose =-5; //洛腓麒磬 爨犟桁嚯钽?筢赅 ?% 羼腓 羼螯 铕溴疣 镱耠?TimeClose
extern string c4="------------------------";
extern string SYMBOL_1 ="EURUSD"; //翌疸钼? 镟疣
extern string SYMBOL_2 ="GBPUSD"; //翌疸钼? 镟疣
extern string SYMBOL_3 ="NZDUSD"; //翌疸钼? 镟疣
extern string SYMBOL_4 ="AUDUSD"; //翌疸钼? 镟疣
extern string SYMBOL_5 ="USDCAD"; //翌疸钼? 镟疣
extern string c5="------------------------";
extern int TF =5; //朽犷麒蜷 蜞殪 麴彘?
extern int FrameBar =1440; //袜 赅觐?麴彘戾 翳朦蝠箦?怩钿?
extern int Magic =7777; //锑痍屦 铕溴痤?
//--------------------------------------------------------------------+
string CommentEA ="FM-CONECTION";
int D;
bool Buy1,Sell1,Buy2,Sell2,Buy3,Sell3,Buy4,Sell4,Buy5,Sell5,clos;
int init()
{D=1;
if (Digits==5 || Digits==3)D=10;
return(0);}
//--------------------------------------------------------------------+
int start(){
//--------------------------------------------------------------------+

double Lot=0;
Lot=NormalizeDouble(AccountBalance()/100*Risk/(MarketInfo(Symbol(),MODE_TICKVALUE)*100*D),2);
if (Lot<MarketInfo(Symbol(),MODE_MINLOT))Lot=MarketInfo(Symbol(),MODE_MINLOT);

double MaxLot=0;
MaxLot=NormalizeDouble(AccountBalance()/100*MaxRisk/(MarketInfo(Symbol(),MODE_TICKVALUE)*100*D),2);
if (MaxLot<MarketInfo(Symbol(),MODE_MINLOT))MaxLot=MarketInfo(Symbol(),MODE_MINLOT);

if(MarketInfo(Symbol(),MODE_LOTSTEP)==0.01) int dig =2;
if(MarketInfo(Symbol(),MODE_LOTSTEP)==0.10) dig =1;
if(MarketInfo(Symbol(),MODE_LOTSTEP)==1.00) dig =0;
//--------------------------------------------------------------------+
double allorders=Count(-1,SYMBOL_1)+Count(-1,SYMBOL_2)+Count(-1,SYMBOL_3)+Count(-1,SYMBOL_4)+Count(-1,SYMBOL_5);
//--------------------------------------------------------------------+
double NLot1=Lot*(MathPow(UpLot,Count(-1,SYMBOL_1)));
if(NLot1>=MaxLot){double NewLot1=MaxLot;}
if(NLot1<MaxLot){NewLot1=NLot1;}

double NLot2=Lot*(MathPow(UpLot,Count(-1,SYMBOL_2)));
if(NLot2>=MaxLot){double NewLot2=MaxLot;}
if(NLot2<MaxLot){NewLot2=NLot2;}

double NLot3=Lot*(MathPow(UpLot,Count(-1,SYMBOL_3)));
if(NLot3>=MaxLot){double NewLot3=MaxLot;}
if(NLot3<MaxLot){NewLot3=NLot3;}

double NLot4=Lot*(MathPow(UpLot,Count(-1,SYMBOL_4)));
if(NLot4>=MaxLot){double NewLot4=MaxLot;}
if(NLot4<MaxLot){NewLot4=NLot4;}

double NLot5=Lot*(MathPow(UpLot,Count(-1,SYMBOL_5)));
if(NLot5>=MaxLot){double NewLot5=MaxLot;}
if(NLot5<MaxLot){NewLot5=NLot5;}
//--------------------------------------------------------------------+
Buy1=false;Sell1=false;
if (iOpen(SYMBOL_1,TF,1)<iClose(SYMBOL_1,TF,1) && iOpen(SYMBOL_1,TF,2)<iClose(SYMBOL_1,TF,2) &&
iOpen(SYMBOL_1,TF,3)>iClose(SYMBOL_1,TF,3) && iOpen(SYMBOL_1,TF,4)>iClose(SYMBOL_1,TF,4) && iOpen(SYMBOL_1,TF,5)>iClose(SYMBOL_1,TF,5))Buy1=true;
if (iOpen(SYMBOL_1,TF,1)>iClose(SYMBOL_1,TF,1) && iOpen(SYMBOL_1,TF,2)>iClose(SYMBOL_1,TF,2) &&
iOpen(SYMBOL_1,TF,3)<iClose(SYMBOL_1,TF,3) && iOpen(SYMBOL_1,TF,4)<iClose(SYMBOL_1,TF,4) && iOpen(SYMBOL_1,TF,5)<iClose(SYMBOL_1,TF,5))Sell1=true;
Buy2=false;Sell2=false;
if (iOpen(SYMBOL_2,TF,1)<iClose(SYMBOL_2,TF,1) && iOpen(SYMBOL_2,TF,2)<iClose(SYMBOL_2,TF,2) &&
iOpen(SYMBOL_2,TF,3)>iClose(SYMBOL_2,TF,3) && iOpen(SYMBOL_2,TF,4)>iClose(SYMBOL_2,TF,4) && iOpen(SYMBOL_2,TF,5)>iClose(SYMBOL_2,TF,5))Buy2=true;
if (iOpen(SYMBOL_2,TF,1)>iClose(SYMBOL_2,TF,1) && iOpen(SYMBOL_2,TF,2)>iClose(SYMBOL_2,TF,2) &&
iOpen(SYMBOL_2,TF,3)<iClose(SYMBOL_2,TF,3) && iOpen(SYMBOL_2,TF,4)<iClose(SYMBOL_2,TF,4) && iOpen(SYMBOL_2,TF,5)<iClose(SYMBOL_2,TF,5))Sell2=true;
Buy3=false;Sell3=false;
if (iOpen(SYMBOL_3,TF,1)<iClose(SYMBOL_3,TF,1) && iOpen(SYMBOL_3,TF,2)<iClose(SYMBOL_3,TF,2) &&
iOpen(SYMBOL_3,TF,3)>iClose(SYMBOL_3,TF,3) && iOpen(SYMBOL_3,TF,4)>iClose(SYMBOL_3,TF,4) && iOpen(SYMBOL_3,TF,5)>iClose(SYMBOL_3,TF,5))Buy3=true;
if (iOpen(SYMBOL_3,TF,1)>iClose(SYMBOL_3,TF,1) && iOpen(SYMBOL_3,TF,2)>iClose(SYMBOL_3,TF,2) &&
iOpen(SYMBOL_3,TF,3)<iClose(SYMBOL_3,TF,3) && iOpen(SYMBOL_3,TF,4)<iClose(SYMBOL_3,TF,4) && iOpen(SYMBOL_3,TF,5)<iClose(SYMBOL_3,TF,5))Sell3=true;
Buy4=false;Sell4=false;
if (iOpen(SYMBOL_4,TF,1)<iClose(SYMBOL_4,TF,1) && iOpen(SYMBOL_4,TF,2)<iClose(SYMBOL_4,TF,2) &&
iOpen(SYMBOL_4,TF,3)>iClose(SYMBOL_4,TF,3) && iOpen(SYMBOL_4,TF,4)>iClose(SYMBOL_4,TF,4) && iOpen(SYMBOL_4,TF,5)>iClose(SYMBOL_4,TF,5))Buy4=true;
if (iOpen(SYMBOL_4,TF,1)>iClose(SYMBOL_4,TF,1) && iOpen(SYMBOL_4,TF,2)>iClose(SYMBOL_4,TF,2) &&
iOpen(SYMBOL_4,TF,3)<iClose(SYMBOL_4,TF,3) && iOpen(SYMBOL_4,TF,4)<iClose(SYMBOL_4,TF,4) && iOpen(SYMBOL_4,TF,5)<iClose(SYMBOL_4,TF,5))Sell4=true;
Buy5=false;Sell5=false;
if (iOpen(SYMBOL_5,TF,1)<iClose(SYMBOL_5,TF,1) && iOpen(SYMBOL_5,TF,2)<iClose(SYMBOL_5,TF,2) &&
iOpen(SYMBOL_5,TF,3)>iClose(SYMBOL_5,TF,3) && iOpen(SYMBOL_5,TF,4)>iClose(SYMBOL_5,TF,4) && iOpen(SYMBOL_5,TF,5)>iClose(SYMBOL_5,TF,5))Buy1=true;
if (iOpen(SYMBOL_5,TF,1)>iClose(SYMBOL_5,TF,1) && iOpen(SYMBOL_5,TF,2)>iClose(SYMBOL_5,TF,2) &&
iOpen(SYMBOL_5,TF,3)<iClose(SYMBOL_5,TF,3) && iOpen(SYMBOL_5,TF,4)<iClose(SYMBOL_5,TF,4) && iOpen(SYMBOL_5,TF,5)<iClose(SYMBOL_5,TF,5))Sell1=true;
//--------------------------------------------------------------------+
if(TimeHour(TimeCurrent())>=TimeStart && TimeHour(TimeCurrent())<TimeEnd)
{

if (iOpen(SYMBOL_1,FrameBar,1)>iClose(SYMBOL_1,FrameBar,1) && Count(-1,SYMBOL_1)==0 && Count2(-1,SYMBOL_1)==0 && Buy1)
{int op1=OrderSend(SYMBOL_1,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if (iOpen(SYMBOL_1,FrameBar,1)<iClose(SYMBOL_1,FrameBar,1) && Count(-1,SYMBOL_1)==0 && Count2(-1,SYMBOL_1)==0 && Sell1)
{int op2=OrderSend(SYMBOL_1,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if (iOpen(SYMBOL_2,FrameBar,1)>iClose(SYMBOL_2,FrameBar,1) && Count(-1,SYMBOL_2)==0 && Count2(-1,SYMBOL_2)==0 && Buy2)
{int op3=OrderSend(SYMBOL_2,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_ASK), Digits),200,0,0,CommentEA,Magic,0,Green);}
if (iOpen(SYMBOL_2,FrameBar,1)<iClose(SYMBOL_2,FrameBar,1) && Count(-1,SYMBOL_2)==0 && Count2(-1,SYMBOL_2)==0 && Sell2)
{int op4=OrderSend(SYMBOL_2,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_BID), Digits),200,0,0,CommentEA,Magic,0,Red);}

if (iOpen(SYMBOL_3,FrameBar,1)>iClose(SYMBOL_3,FrameBar,1) && Count(-1,SYMBOL_3)==0 && Count2(-1,SYMBOL_3)==0 && Buy3)
{int op5=OrderSend(SYMBOL_3,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_ASK), Digits),300,0,0,CommentEA,Magic,0,Green);}
if (iOpen(SYMBOL_3,FrameBar,1)<iClose(SYMBOL_3,FrameBar,1) && Count(-1,SYMBOL_3)==0 && Count2(-1,SYMBOL_3)==0 && Sell3)
{int op6=OrderSend(SYMBOL_3,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_BID), Digits),300,0,0,CommentEA,Magic,0,Red);}

if (iOpen(SYMBOL_4,FrameBar,1)>iClose(SYMBOL_4,FrameBar,1) && Count(-1,SYMBOL_4)==0 && Count2(-1,SYMBOL_4)==0 && Buy4)
{int op7=OrderSend(SYMBOL_4,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_ASK), Digits),400,0,0,CommentEA,Magic,0,Green);}
if (iOpen(SYMBOL_4,FrameBar,1)<iClose(SYMBOL_4,FrameBar,1) && Count(-1,SYMBOL_4)==0 && Count2(-1,SYMBOL_4)==0 && Sell4)
{int op8=OrderSend(SYMBOL_4,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_BID), Digits),400,0,0,CommentEA,Magic,0,Red);}

if (iOpen(SYMBOL_5,FrameBar,1)>iClose(SYMBOL_5,FrameBar,1) && Count(-1,SYMBOL_5)==0 && Count2(-1,SYMBOL_5)==0 && Buy5)
{int op9=OrderSend(SYMBOL_5,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_ASK), Digits),500,0,0,CommentEA,Magic,0,Green);}
if (iOpen(SYMBOL_5,FrameBar,1)<iClose(SYMBOL_5,FrameBar,1) && Count(-1,SYMBOL_5)==0 && Count2(-1,SYMBOL_5)==0 && Sell5)
{int op10=OrderSend(SYMBOL_5,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_BID), Digits),500,0,0,CommentEA,Magic,0,Red);}

}
//--------------------------------------------------------------------+
if(Count(OP_BUY,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_1)==0 && Count(OP_BUY,SYMBOL_1)>0 && Buy1 && NormalizeDouble((MarketInfo(SYMBOL_1,MODE_ASK)+Step*D*(MarketInfo(SYMBOL_1,MODE_POINT))), Digits)<=OldPricB(SYMBOL_1))
{int send1=OrderSend(SYMBOL_1,OP_BUY,NewLot1,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count(OP_SELL,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_1)==0 && Count(OP_SELL,SYMBOL_1)>0 && Sell1 && NormalizeDouble((MarketInfo(SYMBOL_1,MODE_BID)-Step*D*(MarketInfo(SYMBOL_1,MODE_POINT))), Digits)>=OldPricS(SYMBOL_1))
{int send2=OrderSend(SYMBOL_1,OP_SELL,NewLot1,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count(OP_BUY,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_2)==0 && Count(OP_BUY,SYMBOL_2)>0 && Buy2 && NormalizeDouble((MarketInfo(SYMBOL_2,MODE_ASK)+Step*D*(MarketInfo(SYMBOL_2,MODE_POINT))), Digits)<=OldPricB(SYMBOL_2))
{int send3=OrderSend(SYMBOL_2,OP_BUY,NewLot2,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count(OP_SELL,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_2)==0 && Count(OP_SELL,SYMBOL_2)>0 && Sell2 && NormalizeDouble((MarketInfo(SYMBOL_2,MODE_BID)-Step*D*(MarketInfo(SYMBOL_2,MODE_POINT))), Digits)>=OldPricS(SYMBOL_2))
{int send4=OrderSend(SYMBOL_2,OP_SELL,NewLot2,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count(OP_BUY,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_3)==0 && Count(OP_BUY,SYMBOL_3)>0 && Buy3 && NormalizeDouble((MarketInfo(SYMBOL_3,MODE_ASK)+Step*D*(MarketInfo(SYMBOL_3,MODE_POINT))), Digits)<=OldPricB(SYMBOL_3))
{int send5=OrderSend(SYMBOL_3,OP_BUY,NewLot3,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count(OP_SELL,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_3)==0 && Count(OP_SELL,SYMBOL_3)>0 && Sell3 && NormalizeDouble((MarketInfo(SYMBOL_3,MODE_BID)-Step*D*(MarketInfo(SYMBOL_3,MODE_POINT))), Digits)>=OldPricS(SYMBOL_3))
{int send6=OrderSend(SYMBOL_3,OP_SELL,NewLot3,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count(OP_BUY,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_4)==0 && Count(OP_BUY,SYMBOL_4)>0 && Buy4 && NormalizeDouble((MarketInfo(SYMBOL_4,MODE_ASK)+Step*D*(MarketInfo(SYMBOL_4,MODE_POINT))), Digits)<=OldPricB(SYMBOL_4))
{int send7=OrderSend(SYMBOL_4,OP_BUY,NewLot4,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count(OP_SELL,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_4)==0 && Count(OP_SELL,SYMBOL_4)>0 && Sell4 && NormalizeDouble((MarketInfo(SYMBOL_4,MODE_BID)-Step*D*(MarketInfo(SYMBOL_4,MODE_POINT))), Digits)>=OldPricS(SYMBOL_4))
{int send8=OrderSend(SYMBOL_4,OP_SELL,NewLot4,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count(OP_BUY,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_5)==0 && Count(OP_BUY,SYMBOL_5)>0 && Buy5 && NormalizeDouble((MarketInfo(SYMBOL_5,MODE_ASK)+Step*D*(MarketInfo(SYMBOL_5,MODE_POINT))), Digits)<=OldPricB(SYMBOL_5))
{int send9=OrderSend(SYMBOL_5,OP_BUY,NewLot5,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count(OP_SELL,SYMBOL_1)<MaxOrders && Count1(-1,SYMBOL_5)==0 && Count(OP_SELL,SYMBOL_5)>0 && Sell5 && NormalizeDouble((MarketInfo(SYMBOL_5,MODE_BID)-Step*D*(MarketInfo(SYMBOL_5,MODE_POINT))), Digits)>=OldPricS(SYMBOL_5))
{int send10=OrderSend(SYMBOL_5,OP_SELL,NewLot5,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}
//--------------------------------------------------------------------+
//----------------------念腓?----------------------------+
if (Doliv)
{
if(Count3(-1,SYMBOL_1)==0 && Count(OP_BUY,SYMBOL_1)<MaxOrders && Count(OP_BUY,SYMBOL_1)>0 && NormalizeDouble((MarketInfo(SYMBOL_1,MODE_ASK)-Step*D*(MarketInfo(SYMBOL_1,MODE_POINT))), Digits)>OldPricB(SYMBOL_1))
{int send41=OrderSend(SYMBOL_1,OP_BUY,NewLot1,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count3(-1,SYMBOL_1)==0 && Count(OP_SELL,SYMBOL_1)<MaxOrders && Count(OP_SELL,SYMBOL_1)>0 && NormalizeDouble((MarketInfo(SYMBOL_1,MODE_BID)+Step*D*(MarketInfo(SYMBOL_1,MODE_POINT))), Digits)<OldPricS(SYMBOL_1))
{int send42=OrderSend(SYMBOL_1,OP_SELL,NewLot1,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count3(-1,SYMBOL_2)==0 && Count(OP_BUY,SYMBOL_1)<MaxOrders && Count(OP_BUY,SYMBOL_2)>0 && NormalizeDouble((MarketInfo(SYMBOL_2,MODE_ASK)-Step*D*(MarketInfo(SYMBOL_2,MODE_POINT))), Digits)>OldPricB(SYMBOL_2))
{int send43=OrderSend(SYMBOL_2,OP_BUY,NewLot2,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count3(-1,SYMBOL_2)==0 && Count(OP_SELL,SYMBOL_1)<MaxOrders && Count(OP_SELL,SYMBOL_2)>0 && NormalizeDouble((MarketInfo(SYMBOL_2,MODE_BID)+Step*D*(MarketInfo(SYMBOL_2,MODE_POINT))), Digits)<OldPricS(SYMBOL_2))
{int send44=OrderSend(SYMBOL_2,OP_SELL,NewLot2,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count3(-1,SYMBOL_3)==0 && Count(OP_BUY,SYMBOL_1)<MaxOrders && Count(OP_BUY,SYMBOL_3)>0 && NormalizeDouble((MarketInfo(SYMBOL_3,MODE_ASK)-Step*D*(MarketInfo(SYMBOL_3,MODE_POINT))), Digits)>OldPricB(SYMBOL_3))
{int send45=OrderSend(SYMBOL_3,OP_BUY,NewLot3,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count3(-1,SYMBOL_3)==0 && Count(OP_SELL,SYMBOL_1)<MaxOrders && Count(OP_SELL,SYMBOL_3)>0 && NormalizeDouble((MarketInfo(SYMBOL_3,MODE_BID)+Step*D*(MarketInfo(SYMBOL_3,MODE_POINT))), Digits)<OldPricS(SYMBOL_3))
{int send46=OrderSend(SYMBOL_3,OP_SELL,NewLot3,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count3(-1,SYMBOL_4)==0 && Count(OP_BUY,SYMBOL_1)<MaxOrders && Count(OP_BUY,SYMBOL_4)>0 && NormalizeDouble((MarketInfo(SYMBOL_4,MODE_ASK)-Step*D*(MarketInfo(SYMBOL_4,MODE_POINT))), Digits)>OldPricB(SYMBOL_4))
{int send47=OrderSend(SYMBOL_4,OP_BUY,NewLot4,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count3(-1,SYMBOL_4)==0 && Count(OP_SELL,SYMBOL_1)<MaxOrders && Count(OP_SELL,SYMBOL_4)>0 && NormalizeDouble((MarketInfo(SYMBOL_4,MODE_BID)+Step*D*(MarketInfo(SYMBOL_4,MODE_POINT))), Digits)<OldPricS(SYMBOL_4))
{int send48=OrderSend(SYMBOL_4,OP_SELL,NewLot4,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if(Count3(-1,SYMBOL_5)==0 && Count(OP_BUY,SYMBOL_1)<MaxOrders && Count(OP_BUY,SYMBOL_5)>0 && NormalizeDouble((MarketInfo(SYMBOL_5,MODE_ASK)-Step*D*(MarketInfo(SYMBOL_5,MODE_POINT))), Digits)>OldPricB(SYMBOL_5))
{int send49=OrderSend(SYMBOL_5,OP_BUY,NewLot5,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if(Count3(-1,SYMBOL_5)==0 && Count(OP_SELL,SYMBOL_1)<MaxOrders && Count(OP_SELL,SYMBOL_5)>0 && NormalizeDouble((MarketInfo(SYMBOL_5,MODE_BID)+Step*D*(MarketInfo(SYMBOL_5,MODE_POINT))), Digits)<OldPricS(SYMBOL_5))
{int send410=OrderSend(SYMBOL_5,OP_SELL,NewLot5,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}
}
//--------------------------------------------------------------------+
double ProfProc=(AccountBalance()/100)*(ProfitProcent*allorders);
if(Profit(-1)>=ProfProc && ProfProc!=0)
{Closer();}

double ProfProc2=(AccountBalance()/100)*ProfitProcentPachka;
if(Profit(-1)>=ProfProc2 && ProfProc2!=0)
{Closer();}

if(TimeHour(TimeCurrent())>=TimeClose)
{double ProfProcL=(AccountBalance()/100)*ProfitTimeClose;
if(Profit(-1)>=ProfProcL && ProfProcL!=0)
{Closer();}}

double S_Max=(AccountBalance()/100)*StopMinus*(-1);

if(Profit(-1)<S_Max && S_Max!=0)
{Closer();}
//--------------------------------------------------------------------+
// 项赅琨忄屐 桧纛痨圉棹 磬 沭圄桕? |
//--------------------------------------------------------------------+
CSSComent();
//--------------------------------------------------------------------+
return(0);}
//--------------------------------------------------------------------+
int Count(int type,string sy)
{int count=0;
for(int i=OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{if(sy==OrderSymbol() && OrderMagicNumber()==Magic && (type==-1 || OrderType()==type)) count++;}}
return(count);}

int Count1(int type,string sy)
{int count=0;
for(int i=OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{if(sy==OrderSymbol() && OrderMagicNumber()==Magic && OrderOpenTime()>=iTime(sy,TF,0) && (type==-1 || OrderType()==type)) count++;}}
return(count);}

int Count2(int type,string sy)
{int count=0;
for(int i=OrdersHistoryTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{if(sy==OrderSymbol() && OrderMagicNumber()==Magic && OrderOpenTime()>=iTime(sy,FrameBar,0) && (type==-1 || OrderType()==type)) count++;}}
return(count);}

int Count3(int type,string sy)
{int count=0;
for(int i=OrdersTotal()-1;i>=0;i--){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{if(sy==OrderSymbol() && OrderMagicNumber()==Magic && OrderProfit()<0 && (type==-1 || OrderType()==type)) count++;}}
return(count);}
//--------------------------------------------------------------------+
double OldPricB(string sy)
{double oldorderopenpriceB;
int oldticketnumberB;
double unusedB = 0;
int ticketnumberB = 0;
for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--)
{if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
{if (OrderSymbol() == sy && OrderType() == OP_BUY && OrderMagicNumber()==Magic)
{oldticketnumberB = OrderTicket();
if (oldticketnumberB > ticketnumberB)
{ticketnumberB = oldticketnumberB;
oldorderopenpriceB = OrderOpenPrice();
unusedB = oldorderopenpriceB;}}}}
return (oldorderopenpriceB);}
//--------------------------------------------------------------------+
double OldPricS(string sy)
{double oldorderopenpriceS;
int oldticketnumberS;
double unusedS = 0;
int ticketnumberS = 0;
for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--)
{if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
{if (OrderSymbol() == sy && OrderType() == OP_SELL && OrderMagicNumber()==Magic)
{oldticketnumberS = OrderTicket();
if (oldticketnumberS > ticketnumberS)
{ticketnumberS = oldticketnumberS;
oldorderopenpriceS = OrderOpenPrice();
unusedS = oldorderopenpriceS;}}}}
return (oldorderopenpriceS);}
//--------------------------------------------------------------------+
double Profit(int type)
{double Profit = 0;
for (int cnt = OrdersTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES))
{if (OrderMagicNumber()==Magic && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
//--------------------青牮桢-----------------------------------------+
void Closer()
{double priceB, priceS;
for(int i=OrdersTotal()-1;i>=0;i--)
{if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{if(OrderMagicNumber()==Magic && Symbol()==OrderSymbol() && OrderType()==OP_BUY)
{priceB=NormalizeDouble(MarketInfo(OrderSymbol(),MODE_BID), Digits);
clos=OrderClose(OrderTicket(),OrderLots(),priceB,1000,0);}
if(OrderMagicNumber()==Magic && Symbol()==OrderSymbol() && OrderType()==OP_SELL)
{priceS=NormalizeDouble(MarketInfo(OrderSymbol(),MODE_ASK), Digits);
clos=OrderClose(OrderTicket(),OrderLots(),priceS,1000,0);}}}
return;}
//--------------------------------------------------------------------+
// 痒弪麒?玎翳犟桊钼囗铋 镳栳?玎 皴泐漤 |
//--------------------------------------------------------------------+
double ProfitDey(int type)
{double Profit = 0;
for (int cnt = OrdersHistoryTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY))
{if (OrderMagicNumber()==Magic && OrderCloseTime()>=iTime(Symbol(),1440,0) && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
// 痒弪麒?玎翳犟桊钼囗铋 镳栳?玎 怊屦? |
//--------------------------------------------------------------------+
double ProfitTuDey(int type)
{double Profit = 0;
for (int cnt = OrdersHistoryTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY))
{if (OrderMagicNumber()==Magic && OrderCloseTime()>=iTime(Symbol(),1440,1) && OrderCloseTime()<iTime(Symbol(),1440,0) && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
// 痒弪麒?玎翳犟桊钼囗铋 镳栳?玎 镱玎怊屦? |
//--------------------------------------------------------------------+
double ProfitEsTuDey(int type)
{double Profit = 0;
for (int cnt = OrdersHistoryTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY))
{if (OrderMagicNumber()==Magic && OrderCloseTime()>=iTime(Symbol(),1440,2) && OrderCloseTime()<iTime(Symbol(),1440,1) && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
// 痒弪麒?玎翳犟桊钼囗铋 镳栳?玎 礤溴膻 |
//--------------------------------------------------------------------+
double ProfitWeek(int type)
{double Profit = 0;
for (int cnt = OrdersHistoryTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY))
{if (OrderMagicNumber()==Magic && OrderCloseTime()>=iTime(Symbol(),10080,0) && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
// 痒弪麒?玎翳犟桊钼囗铋 镳栳?玎 戾?? |
//--------------------------------------------------------------------+
double ProfitMontag(int type)
{double Profit = 0;
for (int cnt = OrdersHistoryTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY))
{if (OrderMagicNumber()==Magic && OrderCloseTime()>=iTime(Symbol(),43200,0) && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
// 痒弪麒?玎翳犟桊钼囗铋 镳栳?玎 戾?? |
//--------------------------------------------------------------------+
double ProfitAllTime(int type)
{double Profit = 0;
for (int cnt = OrdersHistoryTotal() - 1; cnt >= 0; cnt--) {
if(OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY))
{if (OrderMagicNumber()==Magic && OrderCloseTime()>=iTime(Symbol(),43200,24) && (OrderType() == type || type==-1)) Profit += OrderProfit()+OrderSwap()+OrderCommission();}}
return (Profit);}
//--------------------------------------------------------------------+
// CSS 恹忸溧 桧纛痨圉梃 磬 沭圄桕 |
//--------------------------------------------------------------------+
void CSSComent() {
if (IsTesting() && !IsVisualMode()) return;
if (ObjectFind("BG") < 0) {
ObjectCreate("BG", OBJ_LABEL, 0, 0, 0);
ObjectSetText("BG", "g", 150, "Webdings", White);
ObjectSet("BG", OBJPROP_CORNER, 0);
ObjectSet("BG", OBJPROP_BACK, TRUE);
ObjectSet("BG", OBJPROP_XDISTANCE, 0);
ObjectSet("BG", OBJPROP_YDISTANCE, 15);
}
if (ObjectFind("BG1") < 0) {
ObjectCreate("BG1", OBJ_LABEL, 0, 0, 0);
ObjectSetText("BG1", "g", 150, "Webdings", DimGray);
ObjectSet("BG1", OBJPROP_BACK, FALSE);
ObjectSet("BG1", OBJPROP_XDISTANCE, 0);
ObjectSet("BG1", OBJPROP_YDISTANCE, 42);
}
if (ObjectFind("BG2") < 0) {
ObjectCreate("BG2", OBJ_LABEL, 0, 0, 0);
ObjectSetText("BG2", "g", 150, "Webdings", DimGray);
ObjectSet("BG2", OBJPROP_CORNER, 0);
ObjectSet("BG2", OBJPROP_BACK, TRUE);
ObjectSet("BG2", OBJPROP_XDISTANCE, 0);
ObjectSet("BG2", OBJPROP_YDISTANCE, 42);
}
if (ObjectFind("NAME") < 0) {
ObjectCreate("NAME", OBJ_LABEL, 0, 0, 0);
ObjectSetText("NAME", "FM-CONECTION 漕 2016.03.26", 9, "Arial Bold", Black);
ObjectSet("NAME", OBJPROP_CORNER, 0);
ObjectSet("NAME", OBJPROP_BACK, FALSE);
ObjectSet("NAME", OBJPROP_XDISTANCE, 5);
ObjectSet("NAME", OBJPROP_YDISTANCE, 23);
}
if (ObjectFind("BG3") < 0) {
ObjectCreate("BG3", OBJ_LABEL, 0, 0, 0);
ObjectSetText("BG3", "g", 110, "Webdings", DimGray);
ObjectSet("BG3", OBJPROP_CORNER, 0);
ObjectSet("BG3", OBJPROP_BACK, TRUE);
ObjectSet("BG3", OBJPROP_XDISTANCE, 0);
ObjectSet("BG3", OBJPROP_YDISTANCE, 95);
}
if (ObjectFind("BG5") < 0) {
ObjectCreate("BG5", OBJ_LABEL, 0, 0, 0);
ObjectSetText("BG5", "g", 150, "Webdings", DimGray);
ObjectSet("BG5", OBJPROP_CORNER, 0);
ObjectSet("BG5", OBJPROP_BACK, FALSE);
ObjectSet("BG5", OBJPROP_XDISTANCE, 0);
ObjectSet("BG5", OBJPROP_YDISTANCE, 95);
}
Coment();
}
//--------------------------------------------------------------------+
// 蔓忸?桧纛痨圉梃 磬 沭圄桕 |
//--------------------------------------------------------------------+
void Coment() {
Comment(""
+ "\n"
+ "_______________________________________"
+ "\n"
+ "\n"
+ "韧晕刑乐冗 ?炎乓? "
+ "\n"
+ "_______________________________________"
+ "\n"
+ "皖戾?聍弪? " + AccountNumber()
+ "\n"
+ "想鬻? 1:" + DoubleToStr(AccountLeverage(), 0)
+ "\n"
+ "拎豚眈: " + DoubleToStr(AccountBalance(), 2)
+ "\n"
+ "佯邃耱忄: " + DoubleToStr(AccountEquity(), 2)
+ "\n"
+ "吗屐 皴疴屦? " + TimeToStr(TimeCurrent(), TIME_SECONDS)
+ "\n"
+ "_______________________________________"
+ "\n"
+ "\n"
+ "椅忻温肋 韧晕刑乐冗 "
+ "\n"
+ "_______________________________________"
+ "\n"
+ "义牦?镳铘栩: " + DoubleToStr(Profit(-1), 2)
+ "\n"
+ "橡铘栩 玎 皴泐漤: " + DoubleToStr(ProfitDey(-1), 2)
+ "\n"
+ "橡铘栩 玎 怊屦? " + DoubleToStr(ProfitTuDey(-1), 2)
+ "\n"
+ "橡铘栩 玎 镱玎怊屦? " + DoubleToStr(ProfitEsTuDey(-1), 2)
+ "\n"
+ "橡铘栩 玎 礤溴膻: " + DoubleToStr(ProfitWeek(-1), 2)
+ "\n"
+ "橡铘栩 玎 戾?? " + DoubleToStr(ProfitMontag(-1), 2)
+ "\n"
+ "橡铘栩 玎 怦?怵屐: " + DoubleToStr(ProfitAllTime(-1), 2)
+ "\n"
+ "_______________________________________"
+ "\n"
+ "Skype 潆 疋玷: FXMOMENT"
);
}

相关资源

暂无评论

暂无评论...