FM-POZICION
FM-POZICION

FM-POZICION

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

19 人已下载 手机查看

描述文字
FM-POZICION

//+——————————————————————+
//| FM-POZICION.mq4 |
//| FxMoment |
//| https://fxmoment.ru |
//+——————————————————————+
#property copyright “FxMoment”
#property link “https://fxmoment.ru”
//———————–相疣戾蝠?———————————–+
extern string c0=”————————“;
extern double Risk =10; //需耜, 腩??镳铞屙蜞?
extern double ProfitProcent =20; //羽钼屙?蝈殛 镳铘栩??镳铞屙蜞?镱 钺?镳栳?
extern double StopMinus =0; //锑犟桁嚯 疣珈屦 筢赅 ?镳铞屙蜞?
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 TimeLife =600; //怵屐 骅珥?铕溴痤??扈眢蜞?
extern double ProfitTimeClose =-10; //洛腓麒磬 爨犟桁嚯钽?筢赅 ?%
extern int TF =5; //朽犷麒蜷 蜞殪 麴彘?
extern int FrameBar =240; //襄痂钿 怩钿钼
extern bool info =true; //蔓忸?桧纛痨圉?磬 沭圄桕
extern int Magic =7777; //锑痍屦 铕溴痤?
//——————————————————————–+
string CommentEA =”FM-POZICION”;
datetime NewBar =0;
int D, op;
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);
//——————————————————————–+
if(NewBar!= iTime(Symbol(),1,0))
{NewBar = iTime(Symbol(),1,0);
//——————————————————————–+
Buy1=false;Sell1=false;
if (iHigh(SYMBOL_1,FrameBar,1)<MarketInfo(SYMBOL_1,MODE_BID))Sell1=true;
if (iLow(SYMBOL_1,FrameBar,1)>MarketInfo(SYMBOL_1,MODE_ASK))Buy1=true;
Buy2=false;Sell2=false;
if (iHigh(SYMBOL_2,FrameBar,1)<MarketInfo(SYMBOL_2,MODE_BID))Sell2=true;
if (iLow(SYMBOL_2,FrameBar,1)>MarketInfo(SYMBOL_2,MODE_ASK))Buy2=true;
Buy3=false;Sell3=false;
if (iHigh(SYMBOL_3,FrameBar,1)<MarketInfo(SYMBOL_3,MODE_BID))Sell3=true;
if (iLow(SYMBOL_3,FrameBar,1)>MarketInfo(SYMBOL_3,MODE_ASK))Buy3=true;
Buy4=false;Sell4=false;
if (iHigh(SYMBOL_4,FrameBar,1)<MarketInfo(SYMBOL_4,MODE_BID))Sell4=true;
if (iLow(SYMBOL_4,FrameBar,1)>MarketInfo(SYMBOL_4,MODE_ASK))Buy4=true;
Buy5=false;Sell5=false;
if (iHigh(SYMBOL_5,FrameBar,1)<MarketInfo(SYMBOL_5,MODE_BID))Sell5=true;
if (iLow(SYMBOL_5,FrameBar,1)>MarketInfo(SYMBOL_5,MODE_ASK))Buy5=true;
//——————————————————————–+

if (Count(-1,SYMBOL_1)==0 && Count2(OP_BUY,SYMBOL_1)==0 && Buy1)
{op=OrderSend(SYMBOL_1,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_ASK), Digits),100,0,0,CommentEA,Magic,0,Green);}
if (Count(-1,SYMBOL_1)==0 && Count2(OP_SELL,SYMBOL_1)==0 && Sell1)
{op=OrderSend(SYMBOL_1,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_1,MODE_BID), Digits),100,0,0,CommentEA,Magic,0,Red);}

if (Count(-1,SYMBOL_2)==0 && Count2(OP_BUY,SYMBOL_2)==0 && Buy2)
{op=OrderSend(SYMBOL_2,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_ASK), Digits),200,0,0,CommentEA,Magic,0,Green);}
if (Count(-1,SYMBOL_2)==0 && Count2(OP_SELL,SYMBOL_2)==0 && Sell2)
{op=OrderSend(SYMBOL_2,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_2,MODE_BID), Digits),200,0,0,CommentEA,Magic,0,Red);}

if (Count(-1,SYMBOL_3)==0 && Count2(OP_BUY,SYMBOL_3)==0 && Buy3)
{op=OrderSend(SYMBOL_3,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_ASK), Digits),300,0,0,CommentEA,Magic,0,Green);}
if (Count(-1,SYMBOL_3)==0 && Count2(OP_SELL,SYMBOL_3)==0 && Sell3)
{op=OrderSend(SYMBOL_3,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_3,MODE_BID), Digits),300,0,0,CommentEA,Magic,0,Red);}

if (Count(-1,SYMBOL_4)==0 && Count2(OP_BUY,SYMBOL_4)==0 && Buy4)
{op=OrderSend(SYMBOL_4,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_ASK), Digits),400,0,0,CommentEA,Magic,0,Green);}
if (Count(-1,SYMBOL_4)==0 && Count2(OP_SELL,SYMBOL_4)==0 && Sell4)
{op=OrderSend(SYMBOL_4,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_4,MODE_BID), Digits),400,0,0,CommentEA,Magic,0,Red);}

if (Count(-1,SYMBOL_5)==0 && Count2(OP_BUY,SYMBOL_5)==0 && Buy5)
{op=OrderSend(SYMBOL_5,OP_BUY,Lot,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_ASK), Digits),500,0,0,CommentEA,Magic,0,Green);}
if (Count(-1,SYMBOL_5)==0 && Count2(OP_SELL,SYMBOL_5)==0 && Sell5)
{op=OrderSend(SYMBOL_5,OP_SELL,Lot,NormalizeDouble(MarketInfo(SYMBOL_5,MODE_BID), Digits),500,0,0,CommentEA,Magic,0,Red);}
}
//——————————————————————–+
double ProfProc2=(AccountBalance()/100)*ProfitProcent;
if(Profit(-1)>=ProfProc2 && ProfProc2!=0)
{Closer();}

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

if(Profit(-1)<S_Max && S_Max!=0)
{Closer();}

if(CountTime(-1)>0)
{double ProfProcL=(AccountBalance()/100)*ProfitTimeClose;
if(Profit(-1)>=ProfProcL)
Closer();}
//——————————————————————–+
// 项赅琨忄屐 桧纛痨圉棹 磬 沭圄桕? |
//——————————————————————–+
if(info)
{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 CountTime(int type)
{int count=0;
for(int i=OrdersTotal()-1;i>=0;i–){
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{if(OrderMagicNumber()==Magic && OrderOpenTime()+(TimeLife*60)<TimeCurrent() && (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);}
//——————————————————————–+
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 && OrderType()==OP_BUY)
{priceB=NormalizeDouble(MarketInfo(OrderSymbol(),MODE_BID), Digits);
clos=OrderClose(OrderTicket(),OrderLots(),priceB,1000,0);}
if(OrderMagicNumber()==Magic && 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-POZICION”, 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”
);
}

如果你对文件有了解,请帮助投票!

If you are familiar with the file, please help vote!

平均评分 0 / 5. 投票数: 0

到目前为止还没有投票!成为第一位投票人。

相关资源

暂无评论

none
暂无评论...