这是款马丁EA,个人挂模拟盘测试感觉盈利还可以,爆仓也不可避免但是感觉风险跟盈利是成正比的,控制好仓位应该是款还算可以的EA,所以这里求高手帮我看看这款EA的开仓跟平仓都是根据什么原则,还有参数我都很迷惑,如果后期我需要修改成我自己的EA的话,我会付钱再找你帮我修改,我的微信号是xuduoadmin,手机号17334065406,希望能结交一个长期合作的EA高手。下面是EA源码:
//+------------------------------------------------------------------+
//| |
//| Copyright 2015, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "HFC "
#property link "作者:xxxxxxxxx"
#property version "1.00"
#property description "机构版本策略,很多汇友说回测很不理想,这里说明一下,因为四合一机构版本的有及时锁仓的功能在波动量能上加以计算,所以回测是表现不出来所以会有很大偏差,请先模拟测试不以回测为准 "
#property description " 1、现价买 头寸 方向和大小为参数 "
#property description " 2、上下挂单 上多下空 设距离为参数 数量为前一单的倍数为参数(倍数可以和小,可以为1)"
#property description " 3、上下两单如有一单实现 在该位置重复上步挂单,手数按倍数扩大"
#property description " 4、设最大亏损数额退出参数,设置盈利一定数额后跟踪止盈三个参数"
#property description "比如最大30次 设20次盈利平仓 20次以后盈利大于零就清仓 重来 "
#property strict
#include <stderror.mqh>
#include <stdlib.mqh>
extern string A="--------------------------------------------------5TN---------------------------------------------------";//-----
extern int 首单开仓方向=1; //首单开仓方向 1,只做多。2,只做空。3,多空都做
extern double 下单手数=0.01;
extern double 加仓倍数=2;
extern int 挂单距离=10;
extern int 每组获利点数平仓=10;
extern int 每组获利金额平仓=0;
extern int 每组亏损金额平仓=-500;
extern int 此次数内追踪盈利=10;
extern int 盈利此金额开始追踪=100;
extern int 追踪金额=50;
extern int 最大加仓次数=20;
extern int 每手每点盈利金额=10;
extern string B="----------------------------------------------------M6-----------------------------------------------------";//-----
extern bool Buy=TRUE;//允许买
extern bool Sell=TRUE;//允许卖
extern bool FirstOrder = TRUE;//是不是第一单
extern bool OpenTrend = FALSE;//价格跟趋势一致后过一步后是否下单
extern int FirstStep=10;//第一步点数
extern int MinDistance=30;//最小间距点数(每步之间)
extern int Step=30;//每步点数
extern int MinDistance1=30;//最小间距点数(每步之间)
extern int Step1=30;//每步点数
extern int iCount=5;//几步之后启动方式1点数和最小间距
extern int StepTrallOrders=5;//修改挂单跟踪点数
extern double MaxLoss=100000.0;//最大损失金额
extern double MaxLossCloseAll=10.0;//最大允许平仓的损失金额
extern double lot=0.1;//手数
extern double PlusLot=0.0;//手数增加倍数
extern double K_Lot= 1.5;//手数增加指数(初级手数的多少次方)
extern int DigitsLot = 2;//价格后小数点位数
extern double CloseAll=10.0;//获利金额多少平仓
extern double StopProfit=50.0;//仓位平仓获利金额
extern double StopLoss=100000.0;//中间过程止损金额
extern string parameters_trailing="0-off 1-Candle 2-Fractals >2-pips";
extern int TrailingStop = 1;//跟踪止损点数
extern int TrailingStep = 0;//跟踪止损步数
extern int MinProfit=10;//最小获利
extern int delta=0;
extern int TF_Tralling=15;//时间周期,指标用(0为默认图表周期,单位为分钟)
extern string BB="----------------------------------------------------ZK-----------------------------------------------------";//-----
extern int 开启组数=3;
extern int 每组开仓距离=150;
extern int 总体盈利此金额开始追踪=0;
extern int 总平追踪金额=50;
extern int 总平最多单数=48;
//extern bool W5=TRUE;// 每周五平仓
extern int MagicNumber=555;
int 魔术码A=MagicNumber*10+1;
int 魔术码B=MagicNumber*10+2;
int 魔术码C=MagicNumber*10+3;
int 魔术码m=MagicNumber*10+5;
extern string 备注="巨富无敌";
string 备注A=备注+"-ATEAM";
string 备注B=备注+"-BTEAM";
string 备注C=备注+"-CTEAM";
string 备注M=备注+"-M";
int 启动移动止盈点数=0;
int 移动止盈点数=15;
int 触发平保点数=0;
int 平保点数=5;
string 黄金1="XAUUSD";
string 黄金2="GOLD";
string 白银="XAGUSD";
int SendHour=0;
int 订单方向;
double 订单手数;
double 订单盈亏;
double 订单亏损点数=0;
double 最高获利A=0,最高获利B=0,最高获利C=0,本轮盈利=0;
double Poin_t,Aopen,Bopen,Copen;
int ReceiveError;
datetime NowTime=0;
int Add=0;
datetime 最后开仓时间=0,开仓类型=0;
double 总体盈亏多=0,总体盈亏空=0;
int 所有订单数=0;
int ALLORDERa,ALLORDERb,ALLORDERc,ALLORDERm;
double MaxBuySellLots;
double BuyAllLots,SellAllLots,zdz,zhzgz,zhzdz;
int font_size=10;//字体大小
color text_color=Lime;//字体颜色
int stopLevel;
int Gi_236=5;
int G_acc_number_240;
int slippage;
int buyMinDistance=30;//最小间距点数(每步之间)
int buyStep=30;//每步点数
int sellMinDistance=30;//最小间距点数(每步之间)
int sellStep=30;//每步点数
bool sdqp=FALSE;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
TF_Tralling=f0_0(TF_Tralling);
if(Digits==5 || Digits==3) slippage=30;
stopLevel=(int)MarketInfo(Symbol(),MODE_STOPLEVEL);
if(Step<stopLevel)
{
Alert("Step < STOPLEVEL",stopLevel);
Step=stopLevel;
}
if(FirstStep<stopLevel)
{
Alert("FirstStep < STOPLEVEL",stopLevel);
FirstStep=stopLevel;
}
MaxLossCloseAll=-1.0*MaxLossCloseAll;
MaxLoss=-1.0*MaxLoss;
StopLoss=-1.0*StopLoss;
Poin_t=MarketInfo(Symbol(),MODE_POINT);
if(MarketInfo(Symbol(),MODE_DIGITS)==5)
Poin_t=0.0001;
if(MarketInfo(Symbol(),MODE_DIGITS)==3)
Poin_t=0.01;
if(StringFind(Symbol(),黄金1,0)==0 || StringFind(Symbol(),黄金2,0)==0)
Poin_t=0.1;
if(StringFind(Symbol(),白银,0)==0)
Poin_t=0.01;
SetPanel("mBar",0,0,15,550,450,C'61,61,61',C'61,61,61',1);
// SetPanel("mBar1",0,10,205,500,60,clrBlack,C'61,61,61',1);
SetText("xs1","0",65,21,clrLightGreen,11);
SetText("xs2","0",65,51,clrLightGreen,11);
Create_Button("1close","平A组",58,26,20,48,clrCrimson,clrWhite);
Create_Button("2close","平B组",58,26,20,78,clrCrimson,clrWhite);
Create_Button("3close","平C组",58,26,20,108,clrCrimson,clrWhite);
Create_Button("4close","平M组",58,26,20,138,clrCrimson,clrWhite);
Create_Button("5close","即刻全平",80,30,20,168,clrCrimson,clrWhite);
Create_Button("6stop","本轮全平后自动停止EA",200,30,110,168,clrGreen,clrWhite);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int deinit()
{
ObjectsDeleteAll();
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
if(!GlobalVariableCheck("ypyl")) GlobalVariableSet("ypyl",0);
if(!GlobalVariableCheck("zgz")) GlobalVariableSet("zgz",0);
if(!GlobalVariableCheck("ZTZGZ")) GlobalVariableSet("ZTZGZ",0);
if(!GlobalVariableCheck("QZHYE")) GlobalVariableSet("QZHYE",AccountBalance());
if(!GlobalVariableCheck("Ateamallclose")) GlobalVariableSet("Ateamallclose",0);
if(!GlobalVariableCheck("Bteamallclose")) GlobalVariableSet("Bteamallclose",0);
if(!GlobalVariableCheck("Cteamallclose")) GlobalVariableSet("Cteamallclose",0);
if(!GlobalVariableCheck("Mteamallclose")) GlobalVariableSet("Mteamallclose",0);
if(!GlobalVariableCheck("AMteamallclose")) GlobalVariableSet("AMteamallclose",0);
ALLORDERa=0;
ALLORDERb=0;
ALLORDERc=0;
ALLORDERm=0;
Aopen=0;
Bopen=0;
Copen=0;
datetime ta=TimeCurrent();
datetime tb=TimeCurrent();
datetime tc=TimeCurrent();
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderSymbol()!=Symbol()) continue;
if(OrderMagicNumber()==魔术码A)
{
ALLORDERa++;
if(OrderType()<2)
{
if(ta>OrderOpenTime())
{
ta=OrderOpenTime();
Aopen=OrderOpenPrice();
}
}
continue;
}
if(OrderMagicNumber()==魔术码B)
{
ALLORDERb++;
if(OrderType()<2)
{
if(tb>OrderOpenTime())
{
tb=OrderOpenTime();
Bopen=OrderOpenPrice();
}
}
continue;
}
if(OrderMagicNumber()==魔术码C)
{
ALLORDERc++;
if(OrderType()<2)
{
if(tc>OrderOpenTime())
{
tc=OrderOpenTime();
Copen=OrderOpenPrice();
}
}
continue;
}
if(OrderMagicNumber()==魔术码m) ALLORDERm++;
}
if(ALLORDERa==0) GlobalVariableSet("Ateamallclose",0);
if(ALLORDERb==0) GlobalVariableSet("Bteamallclose",0);
if(ALLORDERc==0) GlobalVariableSet("Cteamallclose",0);
if(ALLORDERm==0) GlobalVariableSet("Mteamallclose",0);
if(ALLORDERa==0 && ALLORDERb==0 && ALLORDERc==0 && ALLORDERm==0)
{
GlobalVariableSet("AMteamallclose",0);
GlobalVariableSet("ypyl",0);
GlobalVariableSet("zgz",0);
GlobalVariableSet("ZTZGZ",0);
GlobalVariableSet("QZHYE",AccountBalance());
zdz=0;
if(sdqp) return(0);
}
if(GlobalVariableGet("Ateamallclose")==1) {close(魔术码A);Sleep(800);return(0);}
if(GlobalVariableGet("Bteamallclose")==1) {close(魔术码B);Sleep(800);return(0);}
if(GlobalVariableGet("Cteamallclose")==1) {close(魔术码C);Sleep(800);return(0);}
if(GlobalVariableGet("Mteamallclose")==1) {close(魔术码m);Sleep(800);return(0);}
if(GlobalVariableGet("AMteamallclose")==1)
{
zongping();
Sleep(800);
return(0);
}
m6();
SetText("xs4","M组: "+IntegerToString(ALLORDERm)+" 空"+DoubleToString(SellAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏空,2)+" ---- 多"+DoubleToString(BuyAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏多,2),85,144,clrLightGreen,11);
Ateam();
SetText("xs1","A组: "+IntegerToString(ALLORDERa)+" 空"+DoubleToString(SellAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏空,2)+" ---- 多"+DoubleToString(BuyAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏多,2),85,54,clrLightGreen,11);
if(开启组数>1 || ALLORDERb>0) Bteam();
SetText("xs2","B组: "+IntegerToString(ALLORDERb)+" 空"+DoubleToString(SellAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏空,2)+" ---- 多"+DoubleToString(BuyAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏多,2),85,84,clrLightGreen,11);
if(开启组数>2 || ALLORDERc>0) Cteam();
SetText("xs3","C组: "+IntegerToString(ALLORDERc)+" 空"+DoubleToString(SellAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏空,2)+" ---- 多"+DoubleToString(BuyAllLots,2)+"手 盈亏:"+DoubleToString(总体盈亏多,2),85,114,clrLightGreen,11);
double NOWZYL=zongYL();
double ZHYPYL=AccountBalance()-GlobalVariableGet("QZHYE");
double JSYL=NOWZYL+ZHYPYL;
if(JSYL>GlobalVariableGet("ZTZGZ")) GlobalVariableSet("ZTZGZ",JSYL);
double AMJSYL=NOWZYL+GlobalVariableGet("ypyl");
if(AMJSYL>GlobalVariableGet("zgz")) GlobalVariableSet("zgz",AMJSYL);
if(JSYL<zdz) zdz=JSYL;
if(JSYL>zhzgz) zhzgz=JSYL;
if(JSYL<zhzdz) zhzdz=JSYL;
if(总体盈利此金额开始追踪>0)
{
if(GlobalVariableGet("zgz")>总体盈利此金额开始追踪 && AMJSYL<GlobalVariableGet("zgz")-总平追踪金额)
{
GlobalVariableSet("AMteamallclose",1);
GlobalVariableSet("ypyl",0);
zongping();
GlobalVariableSet("zgz",0);
zdz=0;
Sleep(800);
GlobalVariableSet("ZTZGZ",0);
GlobalVariableSet("QZHYE",AccountBalance());
return(0);
}
if(GlobalVariableGet("ZTZGZ")>总体盈利此金额开始追踪 && JSYL<(GlobalVariableGet("ZTZGZ")-总平追踪金额))
{
GlobalVariableSet("AMteamallclose",1);
GlobalVariableSet("ypyl",0);
zongping();
GlobalVariableSet("zgz",0);
GlobalVariableSet("ZTZGZ",0);
zdz=0;
Sleep(800);
GlobalVariableSet("QZHYE",AccountBalance());
return(0);
}
}
if(ALLORDERa+ALLORDERb+ALLORDERc+ALLORDERm>总平最多单数)
{
GlobalVariableSet("AMteamallclose",1);
GlobalVariableSet("ypyl",0);
zongping();
GlobalVariableSet("zgz",0);
GlobalVariableSet("ZTZGZ",0);
zdz=0;
Sleep(800);
GlobalVariableSet("QZHYE",AccountBalance());
return(0);
}
SetText("xs6","历史最高盈利:"+DoubleToString(zhzgz,2)+" --------- 历史最大亏损:"+DoubleToString(zhzdz,2),25,211,clrLightGreen,11);
SetText("xs5","本轮最高盈利:"+DoubleToString(GlobalVariableGet("ZTZGZ"),2),25,250,clrLightGreen,11);
SetText("xs51","本轮最大亏损:"+DoubleToString(zdz,2),210,250,clrLightGreen,11);
SetText("xs8","本轮已平盈利:"+DoubleToString(ZHYPYL,2),25,280,clrLightGreen,11);
SetText("xs81","本轮A,B,C,M组全平盈利:"+DoubleToString(GlobalVariableGet("ypyl"),2),210,280,clrLightGreen,11);
SetText("xs7","持单盈利: "+DoubleToString(NOWZYL,2),25,310,clrLightGreen,11);
SetText("xs71","账户余额: "+DoubleToString(AccountBalance(),2)+" ------- 账户净值: "+DoubleToString(AccountEquity(),2),25,340,clrLightGreen,11);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int number(int mode,int 魔术码)
{
int n=0;
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderType()==mode && OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码) {n++;}
}
return(n);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int numberall(int 魔术码)
{
int n=0;
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码) n++;
}
return(n);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
if(id==CHARTEVENT_OBJECT_CLICK)
{
int ind=StringToInteger(sparam);
if(StringFind(sparam,"close")>=0)
{
int ret=MessageBox("确定此组平仓?","平仓",MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2);
if(ret==IDYES)
{
ObjectSetString(0,sparam,OBJPROP_TEXT,"...");
if(ind==1)
{
GlobalVariableSet("Ateamallclose",1);
ObjectSetString(0,sparam,OBJPROP_TEXT,"平A组");
}
if(ind==2)
{
GlobalVariableSet("Bteamallclose",1);
ObjectSetString(0,sparam,OBJPROP_TEXT,"平B组");
}
if(ind==3)
{
GlobalVariableSet("Cteamallclose",1);
ObjectSetString(0,sparam,OBJPROP_TEXT,"平C组");
}
if(ind==4)
{
GlobalVariableSet("Mteamallclose",1);
ObjectSetString(0,sparam,OBJPROP_TEXT,"平M组");
}
if(ind==5)
{
GlobalVariableSet("AMteamallclose",1);
ObjectSetString(0,sparam,OBJPROP_TEXT,"全平");
sdqp=TRUE;
}
}
ObjectSetInteger(0,sparam,OBJPROP_STATE,0);
return;
}
if(StringFind(sparam,"stop")>=0)
{
sdqp=TRUE;
return;
}
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void close(int MG)
{
while(OrdersTotal()>0)
{
for(int cnt=OrdersTotal();cnt>=0;cnt--)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderMagicNumber()!=MG || OrderSymbol()!=Symbol()) continue;
if(OrderType()>1) ReceiveError=OrderDelete(OrderTicket());
if(OrderType()<=1) ReceiveError=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),100,Green);
}
Sleep(800);
RefreshRates();
if(numberall(MG)==0) break;
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetPanel(string name,int sub_window,int x,int y,int width,int height,color bg_color,color border_clr,int border_width)
{
if(ObjectCreate(0,name,OBJ_RECTANGLE_LABEL,sub_window,0,0))
{
ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
ObjectSetInteger(0,name,OBJPROP_XSIZE,width);
ObjectSetInteger(0,name,OBJPROP_YSIZE,height);
ObjectSetInteger(0,name,OBJPROP_COLOR,border_clr);
ObjectSetInteger(0,name,OBJPROP_BORDER_TYPE,BORDER_FLAT);
ObjectSetInteger(0,name,OBJPROP_WIDTH,border_width);
ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_UPPER);
ObjectSetInteger(0,name,OBJPROP_STYLE,STYLE_SOLID);
ObjectSetInteger(0,name,OBJPROP_BACK,false);
ObjectSetInteger(0,name,OBJPROP_SELECTABLE,0);
ObjectSetInteger(0,name,OBJPROP_SELECTED,0);
ObjectSetInteger(0,name,OBJPROP_HIDDEN,true);
ObjectSetInteger(0,name,OBJPROP_ZORDER,0);
}
ObjectSetInteger(0,name,OBJPROP_BGCOLOR,bg_color);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void SetText(string name,string text,int x,int y,color colour,int fontsize=12)
{
if(ObjectFind(0,name)<0)
ObjectCreate(0,name,OBJ_LABEL,0,0,0);
ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
ObjectSetInteger(0,name,OBJPROP_COLOR,colour);
ObjectSetInteger(0,name,OBJPROP_FONTSIZE,fontsize);
ObjectSetInteger(0,name,OBJPROP_CORNER,CORNER_LEFT_UPPER);
ObjectSetString(0,name,OBJPROP_TEXT,text);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void Create_Button(string but_name,string label,int xsize,int ysize,int xdist,int ydist,int bcolor,int fcolor)
{
if(ObjectFind(0,but_name)<0)
{
if(!ObjectCreate(0,but_name,OBJ_BUTTON,0,0,0))
{
Print(": failed to create the button! Error code = ",GetLastError());
return;
}
ObjectSetString(0,but_name,OBJPROP_TEXT,label);
ObjectSetInteger(0,but_name,OBJPROP_XSIZE,xsize);
ObjectSetInteger(0,but_name,OBJPROP_YSIZE,ysize);
ObjectSetInteger(0,but_name,OBJPROP_CORNER,CORNER_LEFT_UPPER);
ObjectSetInteger(0,but_name,OBJPROP_XDISTANCE,xdist);
ObjectSetInteger(0,but_name,OBJPROP_YDISTANCE,ydist);
ObjectSetInteger(0,but_name,OBJPROP_BGCOLOR,bcolor);
ObjectSetInteger(0,but_name,OBJPROP_COLOR,fcolor);
ObjectSetInteger(0,but_name,OBJPROP_FONTSIZE,10);
ObjectSetInteger(0,but_name,OBJPROP_HIDDEN,true);
//ObjectSetInteger(0,but_name,OBJPROP_BORDER_COLOR,ChartGetInteger(0,CHART_COLOR_FOREGROUND));
ObjectSetInteger(0,but_name,OBJPROP_BORDER_TYPE,BORDER_RAISED);
ChartRedraw();
}
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Ateam()
{
SellAllLots=0;
BuyAllLots=0;
MaxBuySellLots=0;
总体盈亏多=0;
总体盈亏空=0;
所有订单数=0;
if(ALLORDERa==0)
{
GlobalVariableSet("Ateamallclose",0);
最高获利A=0;
if(NowTime!=Time[0])
if(ALLORDERb==0 && ALLORDERc==0)
{
if(首单开仓方向==1) ReceiveError=OrderSend(Symbol(),OP_BUY,下单手数,MarketInfo(Symbol(),MODE_ASK),100,0,0,备注A,魔术码A,0,Blue);
if(首单开仓方向==2) ReceiveError=OrderSend(Symbol(),OP_SELL,下单手数,MarketInfo(Symbol(),MODE_BID),100,0,0,备注A,魔术码A,0,Red);
NowTime=Time[0];
return(0);
}
if(ALLORDERb>0 && ALLORDERc==0)
if(Bopen>0)
{
if(MarketInfo(Symbol(),MODE_ASK)>Bopen && (MarketInfo(Symbol(),MODE_ASK)-Bopen)>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_BUY,下单手数,MarketInfo(Symbol(),MODE_ASK),100,0,0,备注A,魔术码A,0,Blue);
NowTime=Time[0];
return(0);
}
if(MarketInfo(Symbol(),MODE_BID)<Bopen && (Bopen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_SELL,下单手数,MarketInfo(Symbol(),MODE_BID),100,0,0,备注A,魔术码A,0,Red);
NowTime=Time[0];
return(0);
}
}
if(ALLORDERb>0 && ALLORDERc>0)
if(Bopen>0 && Copen>0)
{
if(MarketInfo(Symbol(),MODE_ASK)>Bopen && (MarketInfo(Symbol(),MODE_ASK)-Bopen)>每组开仓距离*Poin_t && MarketInfo(Symbol(),MODE_ASK)>Copen && (MarketInfo(Symbol(),MODE_ASK)-Copen)>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_BUY,下单手数,MarketInfo(Symbol(),MODE_ASK),100,0,0,备注A,魔术码A,0,Blue);
NowTime=Time[0];
return(0);
}
if(MarketInfo(Symbol(),MODE_BID)<Bopen && (Bopen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t && MarketInfo(Symbol(),MODE_BID)<Copen && (Copen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_SELL,下单手数,MarketInfo(Symbol(),MODE_BID),100,0,0,备注A,魔术码A,0,Red);
NowTime=Time[0];
return(0);
}
}
return(0);
}
最后开仓时间=0;
开仓类型=0;
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码A)
{
订单方向=OrderType();
订单手数=OrderLots();
订单盈亏=OrderProfit();
所有订单数++;
if(OrderType()<=1)
{
if(最后开仓时间<OrderOpenTime())
{
最后开仓时间=OrderOpenTime();
开仓类型=OrderType();
}
}
if(OrderType()==OP_SELL)
{
订单亏损点数=(OrderOpenPrice()-Ask)/Poin_t;
总体盈亏空=总体盈亏空+OrderProfit()+OrderCommission()+OrderSwap();
if(MaxBuySellLots<OrderLots()) MaxBuySellLots=OrderLots();
SellAllLots=SellAllLots+OrderLots();
}
if(OrderType()==OP_BUY)
{
订单亏损点数=(Bid-OrderOpenPrice())/Poin_t;
总体盈亏多=总体盈亏多+OrderProfit()+OrderCommission()+OrderSwap();
if(MaxBuySellLots<OrderLots()) MaxBuySellLots=OrderLots();
BuyAllLots=BuyAllLots+OrderLots();
}
}
}
Add=number(OP_BUY,魔术码A)+number(OP_SELL,魔术码A);
//下单手数*MathPow(2,最大加仓次数-1)
if(开仓类型==OP_BUY || 开仓类型==OP_SELL)
{
if(number(OP_BUY,魔术码A)+number(OP_SELL,魔术码A)>0 && number(OP_BUYSTOP,魔术码A)+number(OP_SELLSTOP,魔术码A)+number(OP_BUYLIMIT,魔术码A)+number(OP_SELLLIMIT,魔术码A)==0 && Add<最大加仓次数)
{//下单手数*MathPow(2,最大加仓次数-1)>=MaxBuySellLots){
// ReceiveError=OrderSend(Symbol(),OP_SELLLIMIT,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_ASK)+挂单距离*Poin_t,100,0,0,备注A,魔术码A,0,Blue);
ReceiveError=OrderSend(Symbol(),OP_BUYSTOP,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_ASK)+挂单距离*Poin_t,100,0,0,备注A,魔术码A,0,Blue);
ReceiveError=OrderSend(Symbol(),OP_SELLSTOP,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_BID)-挂单距离*Poin_t,100,0,0,备注A,魔术码A,0,Red);
return(0);
}
}
if(!GlobalVariableCheck("Ateamallclose")) GlobalVariableSet("Ateamallclose",0);
Add=number(OP_BUY,魔术码A)+number(OP_SELL,魔术码A);
double 总体平仓=0;
if(每组获利金额平仓>0) 总体平仓=每组获利金额平仓;
if(每组获利点数平仓>0)
{
if(BuyAllLots>=SellAllLots) 总体平仓=每组获利点数平仓*每手每点盈利金额*(BuyAllLots-SellAllLots);
if(BuyAllLots<SellAllLots) 总体平仓=每组获利点数平仓*每手每点盈利金额*(SellAllLots-BuyAllLots);
}
if(GlobalVariableGet("Ateamallclose")==0)
{
if(Add>=最大加仓次数 || 总体盈亏多+总体盈亏空>=总体平仓 || 总体盈亏多+总体盈亏空<=每组亏损金额平仓 || (总体盈亏多+总体盈亏空>=0 && 下单手数*MathPow(2,此次数内追踪盈利-1)<MaxBuySellLots))
{
GlobalVariableSet("Ateamallclose",1);
本轮盈利=GlobalVariableGet("ypyl");
if(总体盈亏多+总体盈亏空>0) GlobalVariableSet("ypyl",本轮盈利+总体盈亏多+总体盈亏空);
}
else if(下单手数*MathPow(2,此次数内追踪盈利-1)>=MaxBuySellLots)
{
if(总体盈亏多+总体盈亏空>=盈利此金额开始追踪 && 最高获利A==0) 最高获利A=总体盈亏多+总体盈亏空;
if(最高获利A>0 && 最高获利A<总体盈亏多+总体盈亏空) 最高获利A=总体盈亏多+总体盈亏空;
if(最高获利A>0 && 总体盈亏多+总体盈亏空<=最高获利A-追踪金额)
{
GlobalVariableSet("Ateamallclose",1);
本轮盈利=GlobalVariableGet("ypyl");
if(总体盈亏多+总体盈亏空>0) GlobalVariableSet("ypyl",本轮盈利+总体盈亏多+总体盈亏空);
}
}
}
if(所有订单数==0) GlobalVariableSet("Ateamallclose",0);
int SellStopTick,BuyStopTick,SellLimitTick,BuyLimitTick;
SellStopTick=number(OP_SELLSTOP,魔术码A);
BuyStopTick=number(OP_BUYSTOP,魔术码A);
SellLimitTick=number(OP_SELLLIMIT,魔术码A);
BuyLimitTick=number(OP_BUYLIMIT,魔术码A);
for(int cnt=OrdersTotal();cnt>=0;cnt--)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderMagicNumber()!=魔术码A || OrderSymbol()!=Symbol()) continue;
if(OrderType()>=2 && SellStopTick+BuyStopTick+SellLimitTick+BuyLimitTick==1) {ReceiveError=OrderDelete(OrderTicket());continue;}
if(OrderType()==OP_BUY)
{
if((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())>触发平保点数*Poin_t && 触发平保点数>0)
{
if(OrderStopLoss()<OrderOpenPrice()+Poin_t*平保点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Poin_t*平保点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error4 ",ReceiveError);
}
}
if((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())>启动移动止盈点数*Poin_t && 启动移动止盈点数>0)
{
if(MarketInfo(OrderSymbol(),MODE_BID)-OrderStopLoss()>Poin_t*移动止盈点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_BID)-Poin_t*移动止盈点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error3 ",ReceiveError);
}
}
}
if(OrderType()==OP_SELL)
{
if((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))>触发平保点数*Poin_t && 触发平保点数>0)
{
if(OrderStopLoss()>OrderOpenPrice()-Poin_t*平保点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Poin_t*平保点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error8 ",ReceiveError);
}
}
if((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))>启动移动止盈点数*Poin_t && 启动移动止盈点数>0)
{
if(OrderStopLoss()-MarketInfo(OrderSymbol(),MODE_ASK)>Poin_t*移动止盈点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_ASK)+Poin_t*移动止盈点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error7 ",ReceiveError);
}
}
}
}
if(GlobalVariableGet("Ateamallclose")==1) close(魔术码A);
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Bteam()
{
SellAllLots=0;
BuyAllLots=0;
MaxBuySellLots=0;
总体盈亏多=0;
总体盈亏空=0;
所有订单数=0;
if(ALLORDERb>0)
{
最后开仓时间=0;
开仓类型=0;
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码B)
{
订单方向=OrderType();
订单手数=OrderLots();
订单盈亏=OrderProfit();
所有订单数++;
if(OrderType()<=1)
{
if(最后开仓时间<OrderOpenTime())
{
最后开仓时间=OrderOpenTime();
开仓类型=OrderType();
}
}
if(OrderType()==OP_SELL)
{
订单亏损点数=(OrderOpenPrice()-Ask)/Poin_t;
总体盈亏空=总体盈亏空+OrderProfit()+OrderCommission()+OrderSwap();
if(MaxBuySellLots<OrderLots()) MaxBuySellLots=OrderLots();
SellAllLots=SellAllLots+OrderLots();
}
if(OrderType()==OP_BUY)
{
订单亏损点数=(Bid-OrderOpenPrice())/Poin_t;
总体盈亏多=总体盈亏多+OrderProfit()+OrderCommission()+OrderSwap();
if(MaxBuySellLots<OrderLots()) MaxBuySellLots=OrderLots();
BuyAllLots=BuyAllLots+OrderLots();
}
}
}
Add=number(OP_BUY,魔术码B)+number(OP_SELL,魔术码B);
//下单手数*MathPow(2,最大加仓次数-1)
if(开仓类型==OP_BUY || 开仓类型==OP_SELL)
{
if(number(OP_BUY,魔术码B)+number(OP_SELL,魔术码B)>0 && number(OP_BUYSTOP,魔术码B)+number(OP_SELLSTOP,魔术码B)+number(OP_BUYLIMIT,魔术码B)+number(OP_SELLLIMIT,魔术码B)==0 && Add<最大加仓次数)
{//下单手数*MathPow(2,最大加仓次数-1)>=MaxBuySellLots){
// ReceiveError=OrderSend(Symbol(),OP_SELLLIMIT,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_ASK)+挂单距离*Poin_t,100,0,0,备注B,魔术码B,0,Blue);
ReceiveError=OrderSend(Symbol(),OP_BUYSTOP,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_ASK)+挂单距离*Poin_t,100,0,0,备注B,魔术码B,0,Blue);
ReceiveError=OrderSend(Symbol(),OP_SELLSTOP,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_BID)-挂单距离*Poin_t,100,0,0,备注B,魔术码B,0,Red);
return(0);
}
}
Add=number(OP_BUY,魔术码B)+number(OP_SELL,魔术码B);
double 总体平仓=0;
if(每组获利金额平仓>0) 总体平仓=每组获利金额平仓;
if(每组获利点数平仓>0)
{
if(BuyAllLots>=SellAllLots) 总体平仓=每组获利点数平仓*每手每点盈利金额*(BuyAllLots-SellAllLots);
if(BuyAllLots<SellAllLots) 总体平仓=每组获利点数平仓*每手每点盈利金额*(SellAllLots-BuyAllLots);
}
if(GlobalVariableGet("Bteamallclose")==0)
{
if(Add>=最大加仓次数 || 总体盈亏多+总体盈亏空>=总体平仓 || 总体盈亏多+总体盈亏空<=每组亏损金额平仓 || (总体盈亏多+总体盈亏空>=0 && 下单手数*MathPow(2,此次数内追踪盈利-1)<MaxBuySellLots))
{
GlobalVariableSet("Bteamallclose",1);
本轮盈利=GlobalVariableGet("ypyl");
if(总体盈亏多+总体盈亏空>0) GlobalVariableSet("ypyl",本轮盈利+总体盈亏多+总体盈亏空);
}
else if(下单手数*MathPow(2,此次数内追踪盈利-1)>=MaxBuySellLots)
{
if(总体盈亏多+总体盈亏空>=盈利此金额开始追踪 && 最高获利B==0) 最高获利B=总体盈亏多+总体盈亏空;
if(最高获利B>0 && 最高获利B<总体盈亏多+总体盈亏空) 最高获利B=总体盈亏多+总体盈亏空;
if(最高获利B>0 && 总体盈亏多+总体盈亏空<=最高获利B-追踪金额)
{
GlobalVariableSet("Bteamallclose",1);
本轮盈利=GlobalVariableGet("ypyl");
if(总体盈亏多+总体盈亏空>0) GlobalVariableSet("ypyl",本轮盈利+总体盈亏多+总体盈亏空);
}
}
}
if(所有订单数==0) GlobalVariableSet("Bteamallclose",0);
int SellStopTick,BuyStopTick,SellLimitTick,BuyLimitTick;
SellStopTick=number(OP_SELLSTOP,魔术码B);
BuyStopTick=number(OP_BUYSTOP,魔术码B);
SellLimitTick=number(OP_SELLLIMIT,魔术码B);
BuyLimitTick=number(OP_BUYLIMIT,魔术码B);
int AllTick;
AllTick=OrdersTotal();
for(int cnt=AllTick;cnt>=0;cnt--)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderMagicNumber()!=魔术码B || OrderSymbol()!=Symbol()) continue;
double stp=OrderStopLoss();
double tpt=OrderTakeProfit();
if(OrderType()>=2 && SellStopTick+BuyStopTick+SellLimitTick+BuyLimitTick==1) {ReceiveError=OrderDelete(OrderTicket());continue;}
if(OrderType()==OP_BUY)
{
if((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())>触发平保点数*Poin_t && 触发平保点数>0)
{
if(stp<OrderOpenPrice()+Poin_t*平保点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Poin_t*平保点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error4 ",ReceiveError);
}
}
if((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())>启动移动止盈点数*Poin_t && 启动移动止盈点数>0)
{
if(MarketInfo(OrderSymbol(),MODE_BID)-stp>Poin_t*移动止盈点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_BID)-Poin_t*移动止盈点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error3 ",ReceiveError);
}
}
}
if(OrderType()==OP_SELL)
{
if((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))>触发平保点数*Poin_t && 触发平保点数>0)
{
if(stp>OrderOpenPrice()-Poin_t*平保点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Poin_t*平保点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error8 ",ReceiveError);
}
}
if((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))>启动移动止盈点数*Poin_t && 启动移动止盈点数>0)
{
if(stp-MarketInfo(OrderSymbol(),MODE_ASK)>Poin_t*移动止盈点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_ASK)+Poin_t*移动止盈点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error7 ",ReceiveError);
}
}
}
}
if(GlobalVariableGet("Bteamallclose")==1) close(魔术码B);
return(0);
}
if(ALLORDERb==0)
{
GlobalVariableSet("Bteamallclose",0);
最高获利B=0;
if(NowTime!=Time[0])
{
if(ALLORDERa>0 && ALLORDERc==0)
if(Aopen>0)
{
if(MarketInfo(Symbol(),MODE_ASK)>Aopen && (MarketInfo(Symbol(),MODE_ASK)-Aopen)>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_BUY,下单手数,MarketInfo(Symbol(),MODE_ASK),100,0,0,备注B,魔术码B,0,Blue);
NowTime=Time[0];
return(0);
}
if(MarketInfo(Symbol(),MODE_BID)<Aopen && (Aopen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_SELL,下单手数,MarketInfo(Symbol(),MODE_BID),100,0,0,备注B,魔术码B,0,Red);
NowTime=Time[0];
return(0);
}
}
if(ALLORDERa==0 && ALLORDERc>0)
if(Copen>0)
{
if(MarketInfo(Symbol(),MODE_ASK)>Copen && (MarketInfo(Symbol(),MODE_ASK)-Copen)>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_BUY,下单手数,MarketInfo(Symbol(),MODE_ASK),100,0,0,备注B,魔术码B,0,Blue);
NowTime=Time[0];
return(0);
}
if(MarketInfo(Symbol(),MODE_BID)<Copen && (Copen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_SELL,下单手数,MarketInfo(Symbol(),MODE_BID),100,0,0,备注B,魔术码B,0,Red);
NowTime=Time[0];
return(0);
}
}
}
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double Cteam()
{
SellAllLots=0;
BuyAllLots=0;
MaxBuySellLots=0;
总体盈亏多=0;
总体盈亏空=0;
所有订单数=0;
if(ALLORDERc>0)
{
最后开仓时间=0;
开仓类型=0;
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES))
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码C)
{
订单方向=OrderType();
订单手数=OrderLots();
订单盈亏=OrderProfit();
所有订单数++;
if(OrderType()<=1)
{
if(最后开仓时间<OrderOpenTime())
{
最后开仓时间=OrderOpenTime();
开仓类型=OrderType();
}
}
if(OrderType()==OP_SELL)
{
订单亏损点数=(OrderOpenPrice()-Ask)/Poin_t;
总体盈亏空=总体盈亏空+OrderProfit()+OrderCommission()+OrderSwap();
if(MaxBuySellLots<OrderLots()) MaxBuySellLots=OrderLots();
SellAllLots=SellAllLots+OrderLots();
}
if(OrderType()==OP_BUY)
{
订单亏损点数=(Bid-OrderOpenPrice())/Poin_t;
总体盈亏多=总体盈亏多+OrderProfit()+OrderCommission()+OrderSwap();
if(MaxBuySellLots<OrderLots()) MaxBuySellLots=OrderLots();
BuyAllLots=BuyAllLots+OrderLots();
}
}
}
Add=number(OP_BUY,魔术码C)+number(OP_SELL,魔术码C);
//下单手数*MathPow(2,最大加仓次数-1)
if(开仓类型==OP_BUY || 开仓类型==OP_SELL)
{
if(number(OP_BUY,魔术码C)+number(OP_SELL,魔术码C)>0 && number(OP_BUYSTOP,魔术码C)+number(OP_SELLSTOP,魔术码C)+number(OP_BUYLIMIT,魔术码C)+number(OP_SELLLIMIT,魔术码C)==0 && Add<最大加仓次数)
{//下单手数*MathPow(2,最大加仓次数-1)>=MaxBuySellLots){
// ReceiveError=OrderSend(Symbol(),OP_SELLLIMIT,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_ASK)+挂单距离*Poin_t,100,0,0,备注C,魔术码C,0,Blue);
ReceiveError=OrderSend(Symbol(),OP_BUYSTOP,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_ASK)+挂单距离*Poin_t,100,0,0,备注C,魔术码C,0,Blue);
ReceiveError=OrderSend(Symbol(),OP_SELLSTOP,NormalizeDouble(MaxBuySellLots*加仓倍数,2),MarketInfo(Symbol(), MODE_BID)-挂单距离*Poin_t,100,0,0,备注C,魔术码C,0,Red);
return(0);
}
}
Add=number(OP_BUY,魔术码C)+number(OP_SELL,魔术码C);
double 总体平仓=0;
if(每组获利金额平仓>0) 总体平仓=每组获利金额平仓;
if(每组获利点数平仓>0)
{
if(BuyAllLots>=SellAllLots) 总体平仓=每组获利点数平仓*每手每点盈利金额*(BuyAllLots-SellAllLots);
if(BuyAllLots<SellAllLots) 总体平仓=每组获利点数平仓*每手每点盈利金额*(SellAllLots-BuyAllLots);
}
if(GlobalVariableGet("Cteamallclose")==0)
{
if(Add>=最大加仓次数 || 总体盈亏多+总体盈亏空>=总体平仓 || 总体盈亏多+总体盈亏空<=每组亏损金额平仓 || (总体盈亏多+总体盈亏空>=0 && 下单手数*MathPow(2,此次数内追踪盈利-1)<MaxBuySellLots))
{
GlobalVariableSet("Cteamallclose",1);
本轮盈利=GlobalVariableGet("ypyl");
if(总体盈亏多+总体盈亏空>0) GlobalVariableSet("ypyl",本轮盈利+总体盈亏多+总体盈亏空);
}
else if(下单手数*MathPow(2,此次数内追踪盈利-1)>=MaxBuySellLots)
{
if(总体盈亏多+总体盈亏空>=盈利此金额开始追踪 && 最高获利C==0) 最高获利C=总体盈亏多+总体盈亏空;
if(最高获利C>0 && 最高获利C<总体盈亏多+总体盈亏空) 最高获利C=总体盈亏多+总体盈亏空;
if(最高获利C>0 && 总体盈亏多+总体盈亏空<=最高获利C-追踪金额)
{
GlobalVariableSet("Cteamallclose",1);
本轮盈利=GlobalVariableGet("ypyl");
if(总体盈亏多+总体盈亏空>0) GlobalVariableSet("ypyl",本轮盈利+总体盈亏多+总体盈亏空);
}
}
}
if(所有订单数==0) GlobalVariableSet("Cteamallclose",0);
int SellStopTick,BuyStopTick,SellLimitTick,BuyLimitTick;
SellStopTick=number(OP_SELLSTOP,魔术码C);
BuyStopTick=number(OP_BUYSTOP,魔术码C);
SellLimitTick=number(OP_SELLLIMIT,魔术码C);
BuyLimitTick=number(OP_BUYLIMIT,魔术码C);
int AllTick;
AllTick=OrdersTotal();
for(int cnt=AllTick;cnt>=0;cnt--)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderMagicNumber()!=魔术码C || OrderSymbol()!=Symbol()) continue;
double stp=OrderStopLoss();
double tpt=OrderTakeProfit();
if(OrderType()>=2 && SellStopTick+BuyStopTick+SellLimitTick+BuyLimitTick==1) {ReceiveError=OrderDelete(OrderTicket());continue;}
if(OrderType()==OP_BUY)
{
if((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())>触发平保点数*Poin_t && 触发平保点数>0)
{
if(stp<OrderOpenPrice()+Poin_t*平保点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+Poin_t*平保点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error4 ",ReceiveError);
}
}
if((MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice())>启动移动止盈点数*Poin_t && 启动移动止盈点数>0)
{
if(MarketInfo(OrderSymbol(),MODE_BID)-stp>Poin_t*移动止盈点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_BID)-Poin_t*移动止盈点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error3 ",ReceiveError);
}
}
}
if(OrderType()==OP_SELL)
{
if((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))>触发平保点数*Poin_t && 触发平保点数>0)
{
if(stp>OrderOpenPrice()-Poin_t*平保点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-Poin_t*平保点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error8 ",ReceiveError);
}
}
if((OrderOpenPrice()-MarketInfo(OrderSymbol(),MODE_ASK))>启动移动止盈点数*Poin_t && 启动移动止盈点数>0)
{
if(stp-MarketInfo(OrderSymbol(),MODE_ASK)>Poin_t*移动止盈点数)
{
ReceiveError=OrderModify(OrderTicket(),OrderOpenPrice(),MarketInfo(OrderSymbol(),MODE_ASK)+Poin_t*移动止盈点数,OrderTakeProfit(),0,Green);
if(ReceiveError<0) Print(" Error7 ",ReceiveError);
}
}
}
}
if(GlobalVariableGet("Cteamallclose")==1) close(魔术码C);
return(0);
}
if(ALLORDERc==0)
{
GlobalVariableSet("Cteamallclose",0);
最高获利C=0;
if(NowTime!=Time[0])
if(ALLORDERa>0 && ALLORDERb>0)
if(Aopen>0 && Bopen>0)
{
if(MarketInfo(Symbol(),MODE_ASK)>Bopen && MarketInfo(Symbol(),MODE_ASK)>Aopen)
if((MarketInfo(Symbol(),MODE_ASK)-Bopen)>每组开仓距离*Poin_t && (MarketInfo(Symbol(),MODE_ASK)-Aopen)>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_BUY,下单手数,MarketInfo(Symbol(),MODE_ASK),100,0,0,备注C,魔术码C,0,Blue);
NowTime=Time[0];
return(0);
}
if(MarketInfo(Symbol(),MODE_BID)<Bopen && MarketInfo(Symbol(),MODE_BID)<Aopen)
if((Bopen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t && (Aopen-MarketInfo(Symbol(),MODE_BID))>每组开仓距离*Poin_t)
{
ReceiveError=OrderSend(Symbol(),OP_SELL,下单手数,MarketInfo(Symbol(),MODE_BID),100,0,0,备注C,魔术码C,0,Red);
NowTime=Time[0];
return(0);
}
}
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int zongping()
{
while(OrdersTotal()>0)
{
for(int cnt=OrdersTotal();cnt>=0;cnt--)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderSymbol()!=Symbol()) continue;
if(OrderMagicNumber()==魔术码A || OrderMagicNumber()==魔术码B || OrderMagicNumber()==魔术码C || OrderMagicNumber()==魔术码m)
{
if(OrderType()>1) ReceiveError=OrderDelete(OrderTicket());
if(OrderType()<2) ReceiveError=OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),100,Green);
}
}
Sleep(800);
RefreshRates();
if((numberall(魔术码A)+numberall(魔术码B)+numberall(魔术码C)+numberall(魔术码m))==0) break;
}
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double zongYL()
{
double ZYL=0;
for(int cnt=0;cnt<OrdersTotal();cnt++)
{
if(!OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderSymbol()!=Symbol()) continue;
if(OrderMagicNumber()==魔术码A || OrderMagicNumber()==魔术码B || OrderMagicNumber()==魔术码C || OrderMagicNumber()==魔术码m)
if(OrderType()<2) ZYL=ZYL+OrderProfit()+OrderCommission()+OrderSwap();
}
return(ZYL);
}
//+------------------------------------------------------------------+
void m6()
{
double Ld_8=0;
double Ld_16=0;
double Ld_24=0;
double Ld_32=0;
double order_lots;
int Li_48=0;
int Li_52=0;
int Li_56=0;
int Li_60=0;
int ticket_68=0;
int ticket_72=0;
double price_76=0;
double price_84=0;
double price_92=0;
double price_100=0;
double price_108=0.0;
double price_116=0.0;
double Ld_124=0;
double Ld_132=0;
double price_140=0;
double price_148=0;
double price_156;
double price_164;
double price_172;
double price_180;
double lots_188;
int pos;
for(pos=0; pos<OrdersTotal(); pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && 魔术码m==OrderMagicNumber())
{
order_lots=OrderLots();
if(OrderType()==OP_BUYSTOP)
{
Li_56++;
if(price_76<OrderOpenPrice() || price_76==0.0) price_76=OrderOpenPrice();
ticket_68 = OrderTicket();
price_108 = OrderOpenPrice();
}
if(OrderType()==OP_SELLSTOP)
{
Li_60++;
if(price_100>OrderOpenPrice() || price_100==0.0) price_100=OrderOpenPrice();
ticket_72 = OrderTicket();
price_116 = OrderOpenPrice();
}
if(OrderType()==OP_BUY)
{
Li_48++;
Ld_24+=order_lots;
Ld_132+=OrderOpenPrice()*order_lots;
if(price_76 < OrderOpenPrice() || price_76 == 0.0) price_76 = OrderOpenPrice();
if(price_84 > OrderOpenPrice() || price_84 == 0.0) price_84 = OrderOpenPrice();
Ld_16+=OrderProfit()+OrderSwap()+OrderCommission();
}
if(OrderType()==OP_SELL)
{
Li_52++;
Ld_32+=order_lots;
Ld_124+=OrderOpenPrice()*order_lots;
if(price_100>OrderOpenPrice() || price_100 == 0.0) price_100 = OrderOpenPrice();
if(price_92 < OrderOpenPrice() || price_92 == 0.0) price_92 = OrderOpenPrice();
Ld_8+=OrderProfit()+OrderSwap()+OrderCommission();
}
}
}
}
SellAllLots=Ld_32;
总体盈亏空=Ld_8;
BuyAllLots=Ld_24;
总体盈亏多=Ld_16;
if(Li_48>iCount)//buy
{
buyMinDistance=MinDistance1;//最小间距点数(每步之间)
buyStep=Step1;//每步点数
}
else
{
buyMinDistance=MinDistance;//最小间距点数(每步之间)
buyStep=Step;//每步点数
}
if(Li_52>iCount)//sell
{
sellMinDistance=MinDistance1;//最小间距点数(每步之间)
sellStep=Step1;//每步点数
}
else
{
sellMinDistance=MinDistance;//最小间距点数(每步之间)
sellStep=Step;//每步点数
}
ObjectDelete("SLb");
ObjectDelete("SLs");
if(Li_48>0)
{
price_140=NormalizeDouble(Ld_132/Ld_24,Digits);
ObjectCreate("SLb",OBJ_ARROW,0,Time[0],price_140,0,0,0,0);
ObjectSet("SLb",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet("SLb",OBJPROP_COLOR,Blue);
}
if(Li_52>0)
{
price_148=NormalizeDouble(Ld_124/Ld_32,Digits);
ObjectCreate("SLs",OBJ_ARROW,0,Time[0],price_148,0,0,0,0);
ObjectSet("SLs",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet("SLs",OBJPROP_COLOR,Red);
}
if(TrailingStop!=0)
{
for(pos=0; pos<OrdersTotal(); pos++)
{
if(OrderSelect(pos,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && 魔术码m==OrderMagicNumber())
{
price_156= NormalizeDouble(OrderStopLoss(),Digits);
price_164=price_156;
if(OrderType()==OP_BUY)
{
price_172=f0_2(1,Bid,TrailingStop);
if(price_172>=price_140+MinProfit*Point && price_172>price_156+TrailingStep*Point && (Bid-price_172)/Point>stopLevel) price_164=price_172;
if(price_164>price_156)
if(!OrderModify(OrderTicket(),OrderOpenPrice(),price_164,OrderTakeProfit(),0,White)) Print("Error ",GetLastError()," TrailingStop Modify Buy SL ",price_156,"->",price_164);
}
if(OrderType()==OP_SELL)
{
price_172=f0_2(-1,Ask,TrailingStop);
if(price_172<=price_148-MinProfit*Point && (price_172<price_156-TrailingStep*Point || (price_156==0.0)) && (price_172-Ask)/Point>stopLevel) price_164=price_172;
if(price_164<price_156 || (price_156==0.0 && price_164!=0.0))
if(!OrderModify(OrderTicket(),OrderOpenPrice(),price_164,OrderTakeProfit(),0,White)) Print("Error ",GetLastError()," TrailingStop Modify Sell SL ",price_156,"->",price_164," TP ");
}
}
}
}
}
if(Ld_16>MaxLossCloseAll && Ld_8>MaxLossCloseAll)
{
ObjectSetText("Char.op",CharToStr(251),font_size+2,"Wingdings",Silver);
if(Ld_16>=StopProfit)
{
本轮盈利=GlobalVariableGet("ypyl");
GlobalVariableSet("ypyl",本轮盈利+Ld_16);
f0_1(1);
return;
}
if(Ld_8>=StopProfit)
{
本轮盈利=GlobalVariableGet("ypyl");
GlobalVariableSet("ypyl",本轮盈利+Ld_8);
f0_1(-1);
return;
}
} else {
ObjectSetText("Char.op",CharToStr(74),font_size+2,"Wingdings",Red);
if(Ld_16+Ld_8>=CloseAll)
{
本轮盈利=GlobalVariableGet("ypyl");
GlobalVariableSet("ypyl",本轮盈利+Ld_16+Ld_8);
f0_1(0);
return;
}
}
if(Ld_16<=StopLoss)
{
Print("Buy Loss ",Ld_16);
f0_1(1);
return;
}
if(Ld_8<=StopLoss)
{
Print("Sell Loss ",Ld_8);
f0_1(-1);
return;
}
if(Ld_16<=MaxLoss)
{
ObjectSetText("Char.b",CharToStr(225)+CharToStr(251),font_size,"Wingdings",Red);
}
else ObjectSetText("Char.b",CharToStr(233),font_size,"Wingdings",Lime);
if(Ld_8<=MaxLoss)
{
ObjectSetText("Char.s",CharToStr(226)+CharToStr(251),font_size,"Wingdings",Red);
}
else ObjectSetText("Char.s",CharToStr(234),font_size,"Wingdings",Lime);
if(Li_56==0 && Ld_16>MaxLoss && Buy)
{
if(Li_48==0) price_180=NormalizeDouble(Ask+FirstStep*Point,Digits);
else
{
price_180=NormalizeDouble(Ask+buyMinDistance*Point,Digits);
if(price_180<NormalizeDouble(price_84-buyStep*Point,Digits)) price_180=NormalizeDouble(Ask+buyStep*Point,Digits);
}
if(Li_48==0 || (price_76!=0.0 && price_180>=NormalizeDouble(price_76+buyStep*Point,Digits) && OpenTrend) || (price_84!=0.0 && price_180<=NormalizeDouble(price_84-buyStep*Point,
Digits)))
{
if(Li_48==0) lots_188=lot;else lots_188=NormalizeDouble(lot*MathPow(K_Lot,Li_48)+Li_48*PlusLot,DigitsLot);
if((lots_188<AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED) && Li_48>0) || FirstOrder)
{int res=OrderSend(Symbol(),OP_BUYSTOP,lots_188,price_180,slippage,0,0,"Jay2392947958",魔术码m,0,Blue);}
}
}
if(Li_60==0 && Ld_8>MaxLoss && Sell)
{
if(Li_52==0) price_180=NormalizeDouble(Bid-FirstStep*Point,Digits);
else
{
price_180=NormalizeDouble(Bid-sellMinDistance*Point,Digits);
if(price_180<NormalizeDouble(price_92+sellStep*Point,Digits)) price_180=NormalizeDouble(Bid-sellStep*Point,Digits);
}
if(Li_52==0 || (price_100!=0.0 && price_180<=NormalizeDouble(price_100-sellStep*Point,Digits) && OpenTrend) || (price_92!=0.0 && price_180>=NormalizeDouble(price_92+sellStep*Point,Digits)))
{
if(Li_52==0) lots_188=lot;
else lots_188=NormalizeDouble(lot*MathPow(K_Lot,Li_52)+Li_52*PlusLot,DigitsLot);
if((lots_188<AccountFreeMargin()/MarketInfo(Symbol(),MODE_MARGINREQUIRED) && Li_52>0) || FirstOrder)
int res=OrderSend(Symbol(),OP_SELLSTOP,lots_188,price_180,slippage,0,0,"Jay2392947958",魔术码m,0,Red);
}
}
double Ld_200=Ld_16+Ld_8;
if(Ld_24>0.0)
{
ObjectSetText("ProfitB",StringConcatenate("Buy ",Li_48," Profit ",DoubleToStr(Ld_16,2)," Lot = ",DoubleToStr(Ld_24,2)),font_size,"Arial",f0_3(Ld_16>0.0,65280,255));
}
else ObjectSetText("ProfitB","",font_size,"Arial",Gray);
if(Ld_32>0.0)
{
ObjectSetText("ProfitS",StringConcatenate("Sell ",Li_52," Profit ",DoubleToStr(Ld_8,2)," Lot = ",DoubleToStr(Ld_32,2)),font_size,"Arial",f0_3(Ld_8>0.0,65280,255));
}
else ObjectSetText("ProfitS","",font_size,"Arial",Gray);
if(Ld_32+Ld_24>0.0) ObjectSetText("Profit",StringConcatenate("Profit All ",DoubleToStr(Ld_200,2)),font_size,"Arial",f0_3(Ld_200>=0.0,32768,255));
else ObjectSetText("Profit","",font_size,"Arial",Gray);
if(price_108!=0.0 && Buy)
{
if(Li_48==0) price_180=NormalizeDouble(Ask+FirstStep*Point,Digits);
else price_180=NormalizeDouble(Ask+buyMinDistance*Point,Digits);
if(NormalizeDouble(price_108-StepTrallOrders*Point,Digits)>price_180 && (price_180<=NormalizeDouble(price_84-buyStep*Point,Digits) || price_84==0.0 ||
OpenTrend) && (Li_48==0 || price_180>=NormalizeDouble(price_76+buyStep*Point,Digits) || price_180<=NormalizeDouble(price_84-buyStep*Point,Digits)))
{
if(!OrderModify(ticket_68,price_180,0,0,0,White)) Print("Error ",GetLastError()," Order Modify Buy OOP ",price_108,"->",price_180);
else Print("Order Buy Modify OOP ",OrderOpenPrice(),"->",price_180);
}
}
if(price_116!=0.0 && Sell)
{
if(Li_52==0) price_180=NormalizeDouble(Bid-FirstStep*Point,Digits);
else price_180=NormalizeDouble(Bid-sellMinDistance*Point,Digits);
if(NormalizeDouble(price_116+StepTrallOrders*Point,Digits)<price_180 && (price_180>=NormalizeDouble(price_92+sellStep*Point,Digits) || price_92==0.0 ||
OpenTrend) && (Li_52==0 || price_180<=NormalizeDouble(price_100-sellStep*Point,Digits) || price_180>=NormalizeDouble(price_92+sellStep*Point,Digits)))
{
if(!OrderModify(ticket_72,price_180,0,0,0,White)) Print("Error ",GetLastError()," Order Modify Sell OOP ",price_116,"->",price_180);
else Print("Order Sell Modify OOP ",OrderOpenPrice(),"->",price_180);
}
}
}
// 441F2875E7D7BD4233BE798272C8614E
int f0_1(int Ai_0)
{
int error_4;
int Li_8=0;
int count_16;
bool Li_20=TRUE;
while(true)
{
for(int pos_24=OrdersTotal()-1; pos_24>=0; pos_24--)
{
if(OrderSelect(pos_24,SELECT_BY_POS))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码m)
{
if(OrderType()==OP_BUY && (Ai_0==1 || Ai_0==0))
{
Li_20=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Bid,Digits),slippage,Blue);
}
if(OrderType()==OP_SELL && (Ai_0==-1 || Ai_0==0))
{
Li_20=OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,Digits),slippage,Red);
}
if(OrderType() == OP_BUYSTOP && (Ai_0 == 1 || Ai_0 == 0)) Li_20 = OrderDelete(OrderTicket());
if(OrderType() == OP_SELLSTOP && (Ai_0 == -1 || Ai_0 == 0)) Li_20 = OrderDelete(OrderTicket());
if(!Li_20)
{
error_4=GetLastError();
if(error_4>=2/* COMMON_ERROR */)
{
if(error_4==129/* INVALID_PRICE */)
{
RefreshRates();
continue;
}
if(error_4==146/* TRADE_CONTEXT_BUSY */)
{
if(!(IsTradeContextBusy())) continue;
Sleep(2000);
continue;
}
}
}
}
}
}
count_16=0;
for(int pos_24=0; pos_24<OrdersTotal(); pos_24++)
{
if(OrderSelect(pos_24,SELECT_BY_POS))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==魔术码m)
{
if((OrderType() == OP_BUYSTOP || OrderType() == OP_BUY) && (Ai_0 == 1 || Ai_0 == 0)) count_16++;
if((OrderType() == OP_SELLSTOP || OrderType() == OP_SELL) && (Ai_0 == -1 || Ai_0 == 0)) count_16++;
}
}
}
if(count_16==0) break;
Li_8++;
if(Li_8>10)
{
Alert(Symbol(),"",count_16);
return (0);
}
Sleep(1000);
RefreshRates();
}
return (1);
}
// FE4419DB9A392D72907855C4B2F09487
int f0_3(bool Ai_0,int Ai_4,int Ai_8)
{
if(Ai_0) return (Ai_4);
return (Ai_8);
}
// 8B73C0300B4783F354728356BF7636BE
double f0_2(int Ai_0,double Ad_4,double A_pips_12)
{
double price_20=0;int Li_32=1;
if(A_pips_12>2.0)
{
if(Ai_0==1) price_20=NormalizeDouble(Ad_4-A_pips_12*Point,Digits);
else price_20=NormalizeDouble(Ad_4+A_pips_12*Point,Digits);
}
else
{
if(A_pips_12==2.0)
{
if(Ai_0==1)
{
int Li_28=1;
for(Li_28=1; Li_28<100; Li_28++)
{
price_20=iFractals(Symbol(),TF_Tralling,MODE_LOWER,Li_28);
if(price_20!=0.0)
{
price_20-=NormalizeDouble(delta*Point,Digits);
if(Ad_4-stopLevel*Point>price_20) break;
}
else price_20=0;
}
ObjectDelete("FR Buy");
ObjectCreate("FR Buy",OBJ_ARROW,0,Time[Li_28],price_20+Point,0,0,0,0);
ObjectSet("FR Buy",OBJPROP_ARROWCODE,218);
ObjectSet("FR Buy",OBJPROP_COLOR,Red);
}
if(Ai_0==-1)
{
for(Li_32=1; Li_32<100; Li_32++)
{
price_20=iFractals(Symbol(),TF_Tralling,MODE_UPPER,Li_32);
if(price_20!=0.0)
{
price_20+=NormalizeDouble(delta*Point,Digits);
if(Ad_4+stopLevel*Point<price_20) break;
}
else price_20=0;
}
ObjectDelete("FR Sell");
ObjectCreate("FR Sell",OBJ_ARROW,0,Time[Li_32],price_20,0,0,0,0);
ObjectSet("FR Sell",OBJPROP_ARROWCODE,217);
ObjectSet("FR Sell",OBJPROP_COLOR,Red);
}
}
if(A_pips_12==1.0)
{
if(Ai_0==1)
{
int Li_28=1;
for(Li_28=1; Li_28<500; Li_28++)
{
price_20=NormalizeDouble(iLow(Symbol(),TF_Tralling,Li_28)-delta*Point,Digits);
if(price_20!=0.0)
{
if(Ad_4-stopLevel*Point>price_20) break;
price_20=0;
}
}
ObjectDelete("FR Buy");
ObjectCreate("FR Buy",OBJ_ARROW,0,iTime(Symbol(),TF_Tralling,Li_28),price_20+Point,0,0,0,0);
ObjectSet("FR Buy",OBJPROP_ARROWCODE,159);
ObjectSet("FR Buy",OBJPROP_COLOR,Red);
}
if(Ai_0==-1)
{
for(Li_32=1; Li_32<500; Li_32++)
{
price_20=NormalizeDouble(iHigh(Symbol(),TF_Tralling,Li_32)+delta*Point,Digits);
if(price_20!=0.0)
{
if(Ad_4+stopLevel*Point<price_20) break;
price_20=0;
}
}
ObjectDelete("FR Sell");
ObjectCreate("FR Sell",OBJ_ARROW,0,iTime(Symbol(),TF_Tralling,Li_32),price_20,0,0,0,0);
ObjectSet("FR Sell",OBJPROP_ARROWCODE,159);
ObjectSet("FR Sell",OBJPROP_COLOR,Red);
}
}
}
if(Ai_0==1)
{
if(price_20!=0.0)
{
ObjectDelete("SL Buy");
ObjectCreate("SL Buy",OBJ_ARROW,0,Time[0]+60*Period(),price_20,0,0,0,0);
ObjectSet("SL Buy",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet("SL Buy",OBJPROP_COLOR,Blue);
}
if(stopLevel>0)
{
ObjectDelete("STOPLEVEL-");
ObjectCreate("STOPLEVEL-",OBJ_ARROW,0,Time[0]+60*Period(),Ad_4-stopLevel*Point,0,0,0,0);
ObjectSet("STOPLEVEL-",OBJPROP_ARROWCODE,4);
ObjectSet("STOPLEVEL-",OBJPROP_COLOR,Blue);
}
}
if(Ai_0==-1)
{
if(price_20!=0.0)
{
ObjectDelete("SL Sell");
ObjectCreate("SL Sell",OBJ_ARROW,0,Time[0]+60*Period(),price_20,0,0,0,0);
ObjectSet("SL Sell",OBJPROP_ARROWCODE,SYMBOL_RIGHTPRICE);
ObjectSet("SL Sell",OBJPROP_COLOR,Pink);
}
if(stopLevel>0)
{
ObjectDelete("STOPLEVEL+");
ObjectCreate("STOPLEVEL+",OBJ_ARROW,0,Time[0]+60*Period(),Ad_4+stopLevel*Point,0,0,0,0);
ObjectSet("STOPLEVEL+",OBJPROP_ARROWCODE,4);
ObjectSet("STOPLEVEL+",OBJPROP_COLOR,Pink);
}
}
return (price_20);
}
// 3A62B06A167CFF5D9B2988F1B53DA68C
int f0_0(int Ai_0)
{
if(Ai_0 > 43200) return (0);
if(Ai_0 > 10080) return (43200);
if(Ai_0 > 1440) return (10080);
if(Ai_0 > 240) return (1440);
if(Ai_0 > 60) return (240);
if(Ai_0 > 30) return (60);
if(Ai_0 > 15) return (30);
if(Ai_0 > 5) return (15);
if(Ai_0 > 1) return (5);
if(Ai_0 == 1) return (1);
if(Ai_0 == 0) return (Period());
return (0);
}
//+------------------------------------------------------------------+
|