|
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 分组_平均价_订单量_组号()
- {
- if(OrderType()==OP_BUY && OrderSymbol()==Symbol())
- {
- AvgPrice111111=AvgPrice111111(1,Symbol(),1);
- AvgPrice222222=AvgPrice222222(1,Symbol(),1);
- AvgPrice333333=AvgPrice333333(1,Symbol(),1);
- AvgPrice=AvgPrice(Symbol(),1);
- }
- if(OrderType()==OP_SELL && OrderSymbol()==Symbol())
- {
- AvgPrice111111=AvgPrice111111(2,Symbol(),2);
- AvgPrice222222=AvgPrice222222(2,Symbol(),2);
- AvgPrice333333=AvgPrice333333(2,Symbol(),2);
- AvgPrice=AvgPrice(Symbol(),2);
- }
- counttrades111111=CountTrades111111(1,Symbol(),"",0)+CountTrades111111(2,Symbol(),"",1);
- counttrades222222=CountTrades222222(1,Symbol(),"",0)+CountTrades222222(2,Symbol(),"",1);
- counttrades333333=CountTrades333333(1,Symbol(),"",0)+CountTrades333333(2,Symbol(),"",1);
- counttrades=CountTrades(1,Symbol(),"",0)+CountTrades(2,Symbol(),"",1);
- if(magic==111111)
- {
- AvgPriceX=AvgPrice111111;
- counttradesX=counttrades111111;
- lotN=lotN1;
- ObjectSetInteger(0,"A",OBJPROP_BGCOLOR,clrDarkGreen);
- ObjectSetInteger(0,"A",OBJPROP_FONTSIZE,32);
- }
- if(magic==222222)
- {
- AvgPriceX=AvgPrice222222;
- counttradesX=counttrades222222;
- lotN=lotN2;
- ObjectSetInteger(0,"B",OBJPROP_BGCOLOR,clrDarkGreen);
- ObjectSetInteger(0,"B",OBJPROP_FONTSIZE,32);
- }
- if(magic==333333)
- {
- AvgPriceX=AvgPrice333333;
- counttradesX=counttrades333333;
- lotN=lotN3;
- ObjectSetInteger(0,"C",OBJPROP_BGCOLOR,clrDarkGreen);
- ObjectSetInteger(0,"C",OBJPROP_FONTSIZE,32);
- }
- if(magic==0)
- {
- AvgPriceX=AvgPrice;
- counttradesX=counttrades;
- lotN=lotN0;
- ObjectSetInteger(0,"T",OBJPROP_BGCOLOR,clrDarkGreen);
- ObjectSetInteger(0,"T",OBJPROP_FONTSIZE,24);
- }
- }
- //+------------------------------------------------------------------+
- //| 均线减仓开关归零 |
- //+------------------------------------------------------------------+
- void 均线减仓开关归零(void)
- {
- 均线减仓开关0=0;
- 均线减仓开关1=0;
- 均线减仓开关2=0;
- 均线减仓开关3=0;
- }
- //+------------------------------------------------------------------+
- //| 均线跟踪开关归零 |
- //+------------------------------------------------------------------+
- void 均线跟踪开关归零(void)
- {
- 均线跟踪开关0=0;
- 均线跟踪开关1=0;
- 均线跟踪开关2=0;
- 均线跟踪开关3=0;
- }
- //+------------------------------------------------------------------+
- //| 均线周期 |
- //+------------------------------------------------------------------+
- void 均线周期()
- {
- if(Period()==43200)
- {
- ma1=0;
- matxt1="月";
- ma2=0;
- matxt2="年";
- ma3=0;
- matxt3="----";
- 周期显示="月";
- }
- if(Period()==10080)
- {
- ma1=0;
- matxt1="W1";
- ma2=0;
- matxt2="月";
- ma3=0;
- matxt3="年";
- 周期显示="W1";
- }
- if(Period()==1440)
- {
- ma1=0;
- matxt1="D1";
- ma2=0;
- matxt2="W1";
- ma3=0;
- matxt3="月";
- 周期显示="D1";
- }
- if(Period()==240)
- {
- ma1=14;
- matxt1="H4";
- ma2=0;
- matxt2="D1";
- ma3=0;
- matxt3="W1";
- 周期显示="H4";
- }
- if(Period()==60)
- {
- ma1=14;
- matxt1="H1";
- ma2=56;
- matxt2="H4";
- ma3=336;
- matxt3="D1";
- 周期显示="H1";
- }
- if(Period()==30)
- {
- ma1=28;
- matxt1="H1";
- ma2=112;
- matxt2="H4";
- ma3=672;
- matxt3="D1";
- 周期显示="M30";
- }
- if(Period()==15)
- {
- ma1=14;
- matxt1="M15";
- ma2=56;
- matxt2="H1";
- ma3=224;
- matxt3="H4";
- 周期显示="M15";
- }
- if(Period()==5)
- {
- ma1=14;
- matxt1="M5";
- ma2=42;
- matxt2="M15";
- ma3=168;
- matxt3="H1";
- 周期显示="M5";
- }
- if(Period()==1)
- {
- ma1=14;
- matxt1="M1";
- ma2=70;
- matxt2="M5";
- ma3=210;
- matxt3="M15";
- 周期显示="M1";
- }
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 显示_组件_右侧()
- {
- if(lotN0==0.5 && magic==0)
- ObjectSetInteger(0,"1/2_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN1==0.5 && magic==111111)
- ObjectSetInteger(0,"1/2_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN2==0.5 && magic==222222)
- ObjectSetInteger(0,"1/2_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN3==0.5 && magic==333333)
- ObjectSetInteger(0,"1/2_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN0==0.33333 && magic==0)
- ObjectSetInteger(0,"1/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN1==0.33333 && magic==111111)
- ObjectSetInteger(0,"1/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN2==0.33333 && magic==222222)
- ObjectSetInteger(0,"1/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN3==0.33333 && magic==333333)
- ObjectSetInteger(0,"1/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN0==0.66667 && magic==0)
- ObjectSetInteger(0,"2/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN1==0.66667 && magic==111111)
- ObjectSetInteger(0,"2/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN2==0.66667 && magic==222222)
- ObjectSetInteger(0,"2/3_仓位",OBJPROP_COLOR,clrWhite);
- if(lotN3==0.66667 && magic==333333)
- ObjectSetInteger(0,"2/3_仓位",OBJPROP_COLOR,clrWhite);
- ObjectDelete("跟踪距离");
- ObjectDelete("均线3");
- ObjectDelete("均线2");
- ObjectDelete("均线1");
- ObjectDelete("下单手数");
- ObjectDelete("挂单个数");
- ObjectDelete("挂单点数");
- text("跟踪距离",1,10,"Arial",clrDodgerBlue,(string)跟踪距离+"点",135, 260);
- text("均线3",1,10,"Arial",clrDodgerBlue,DoubleToStr(iMA(NULL,0,ma3,0,MODE_SMA,PRICE_WEIGHTED,0),Digits)+" "+matxt3,180, 324);
- text("均线2",1,10,"Arial",clrDodgerBlue,DoubleToStr(iMA(NULL,0,ma2,0,MODE_SMA,PRICE_WEIGHTED,0),Digits)+" "+matxt2,180, 357);
- text("均线1",1,10,"Arial",clrDodgerBlue,DoubleToStr(iMA(NULL,0,ma1,0,MODE_SMA,PRICE_WEIGHTED,0),Digits)+" "+matxt1,180, 390);
- text("下单手数",1,10,"Arial",clrDodgerBlue,DoubleToStr(下单手数,2)+"手",228, 470);
- text("挂单个数",1,10,"Arial",clrDodgerBlue,DoubleToStr(挂单个数,0)+"个",133, 470);
- text("挂单点数",1,10,"Arial",clrDodgerBlue,DoubleToStr(挂单点数,0)+"点",43, 470);
- string 正负号;
- if(AccountProfit()>0)
- 正负号="+";
- else 正负号="";
- ObjectDelete("账户");
- text("账户",1,9,"Arial",clrWhite,"账户统计:",270, 540);
- ObjectDelete("出入金统计时间");
- for(int pos = OrdersHistoryTotal() - 1; pos >= 0; pos--)
- {
- bool res=OrderSelect(1, SELECT_BY_POS, MODE_HISTORY);
- if(res==true)
- text("出入金统计时间",1,9,"Arial",clrMediumOrchid,"起始日期 "+TimeToStr(OrderOpenTime(),TIME_DATE),180, 540);
- }
- ObjectDelete("入金");
- text("入金",1,9,"Arial",clrMediumOrchid,"入金 "+DoubleToStr(入金(),2),180, 560);
- ObjectDelete("出金");
- text("出金",1,9,"Arial",clrMediumOrchid,"出金 "+DoubleToStr(出金(),2),90, 560);
- ObjectDelete("余额");
- text("余额",1,9,"Arial",clrDodgerBlue,"余额 "+DoubleToStr(AccountBalance(),2),270, 580);
- ObjectDelete("净值");
- text("净值",1,9,"Arial",clrDodgerBlue,"净值 "+DoubleToStr(AccountEquity(),2),180, 580);
- ObjectDelete("浮盈");
- text("浮盈",1,9,"Arial",clrDodgerBlue,"浮盈 "+正负号+DoubleToStr(AccountProfit(),2),90, 580);
- ObjectDelete("当前货币");
- text("当前货币",1,9,"Arial",clrWhite,"当前货币:",270, 615);
- ObjectDelete("无订单Symbol");
- if(counttrades+counttrades111111+counttrades222222+counttrades333333==0)
- text("无订单Symbol",1,9,"Arial",clrDodgerBlue,Symbol()+" 无订单",270, 635);
- ObjectDelete("Symbol");
- for(int a=0; a<OrdersTotal(); a++)
- {
- if(OrderSelect(a,SELECT_BY_POS)==true && OrderSymbol()==Symbol())
- {
- string 正负号1;
- if(当前货币浮盈>0)
- 正负号1="+";
- else 正负号1="";
- string duokong;
- if(OrderType()==0)
- duokong="多单";
- if(OrderType()==1)
- duokong="空单";
- text("Symbol",1,9,"Arial",clrDodgerBlue,Symbol()+" "+duokong+"持仓 "+DoubleToStr(counttrades,2)+" 获利点数 "+正负号1+DoubleToStr(当前货币浮盈,2),270, 635);
- }
- }
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 显示_A组持仓_均价_跟踪_减仓()
- {
- ObjectDelete("无订单a");
- ObjectDelete("多单a");
- ObjectDelete("空单a");
- ObjectDelete("跟踪运行a");
- ObjectDelete("跟踪未启动a");
- ObjectDelete("减仓运行a");
- ObjectDelete("减仓运行a1");
- ObjectDelete("减仓未启动a");
- for(int a=0; a<OrdersTotal(); a++)
- {
- if(OrderSelect(a,SELECT_BY_POS)==true && OrderSymbol()==Symbol())
- {
- if(CountTrades111111(1,Symbol(),"",0)==0 && CountTrades111111(2,Symbol(),"",1)==0)
- text("无订单a",3,9,"Arial",clrDodgerBlue,"A:无订单",270, 240);
- if(CountTrades111111(1,Symbol(),"",0)!=0)
- text("多单a",3,9,"Arial",clrWhite,"A:多单 "+IntegerToString(orders111111(0))+"个 共计 "+DoubleToStr(CountTrades111111(1,Symbol(),"",0),2)+" 均价 "+DoubleToStr(AvgPrice111111(1,Symbol(),1),Digits),270, 240);
- if(CountTrades111111(2,Symbol(),"",1)!=0)
- text("空单a",3,9,"Arial",clrWhite,"A:空单 "+IntegerToString(orders111111(1))+"个 共计 "+DoubleToStr(CountTrades111111(2,Symbol(),"",1),2)+" 均价 "+DoubleToStr(AvgPrice111111(2,Symbol(),2),Digits),270, 240);
- if(CountTrades111111(1,Symbol(),"",0)+CountTrades111111(2,Symbol(),"",1)!=0)
- {
- if(跟踪距离!=0 && 均线跟踪开关1==1 && 跟踪品种==Symbol() && 跟踪周期==Period())
- text("跟踪运行a",3,9,"Arial",clrRed,周期显示+"周期__"+跟踪周期显示1+"均线__"+(string)跟踪距离+"点__跟踪止损,运行中",270, 220);
- else
- text("跟踪未启动a",3,9,"Arial",clrDimGray,"均线跟踪止损 未启动",270, 220);
- if(均线减仓开关1==1 && 减仓品种==Symbol() && 减仓周期==Period())
- {
- if(mark==0)
- text("减仓运行a",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示1+"均线__"+减仓仓位显示1+"减仓,运行中,",270, 200);
- if(mark!=0)
- text("减仓运行a1",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示1+"均线__"+减仓仓位显示1+"减仓,已成功!",270, 200);
- }
- else
- text("减仓未启动a",3,9,"Arial",clrDimGray,"均线减仓 未启动",270, 200);
- }
- }
- }
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 显示_B组持仓_均价_跟踪_减仓()
- {
- ObjectDelete("无订单b");
- ObjectDelete("多单b");
- ObjectDelete("空单b");
- ObjectDelete("跟踪运行b");
- ObjectDelete("跟踪未启动b");
- ObjectDelete("减仓运行b");
- ObjectDelete("减仓运行b1");
- ObjectDelete("减仓未启动b");
- for(int a=0; a<OrdersTotal(); a++)
- {
- if(OrderSelect(a,SELECT_BY_POS)==true && OrderSymbol()==Symbol())
- {
- if(CountTrades222222(1,Symbol(),"",0)==0 && CountTrades222222(2,Symbol(),"",1)==0)
- text("无订单b",3,9,"Arial",clrDodgerBlue,"B:无订单",270, 180);
- if(CountTrades222222(1,Symbol(),"",0)!=0)
- text("多单b",3,9,"Arial",clrWhite,"B:多单 "+IntegerToString(orders222222(0))+"个 共计 "+DoubleToStr(CountTrades222222(1,Symbol(),"",0),2)+" 均价 "+DoubleToStr(AvgPrice222222(1,Symbol(),1),Digits),270, 180);
- if(CountTrades222222(2,Symbol(),"",1)!=0)
- text("空单b",3,9,"Arial",clrWhite,"B:空单 "+IntegerToString(orders222222(1))+"个 共计 "+DoubleToStr(CountTrades222222(2,Symbol(),"",1),2)+" 均价 "+DoubleToStr(AvgPrice222222(2,Symbol(),2),Digits),270, 180);
- if(CountTrades222222(1,Symbol(),"",0)+CountTrades222222(2,Symbol(),"",1)!=0)
- {
- if(跟踪距离!=0 && 均线跟踪开关2==1 && 跟踪品种==Symbol() && 跟踪周期==Period())
- text("跟踪运行b",3,9,"Arial",clrRed,周期显示+"周期__"+跟踪周期显示2+"均线__"+(string)跟踪距离+"点__跟踪止损,运行中",270, 160);
- else
- text("跟踪未启动b",3,9,"Arial",clrDimGray,"均线跟踪止损 未启动",270, 160);
- if(均线减仓开关2==1 && 减仓品种==Symbol() && 减仓周期==Period())
- {
- if(mark==0)
- text("减仓运行b",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示2+"均线__"+减仓仓位显示2+"减仓,运行中,",270, 140);
- if(mark!=0)
- text("减仓运行b1",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示2+"均线__"+减仓仓位显示2+"减仓,已成功!",270, 140);
- }
- else
- text("减仓未启动b",3,9,"Arial",clrDimGray,"均线减仓 未启动",270, 140);
- }
- }
- }
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 显示_C组持仓_均价_跟踪_减仓()
- {
- ObjectDelete("无订单c");
- ObjectDelete("多单c");
- ObjectDelete("空单c");
- ObjectDelete("跟踪运行c");
- ObjectDelete("跟踪未启动c");
- ObjectDelete("减仓运行c");
- ObjectDelete("减仓运行c1");
- ObjectDelete("减仓未启动c");
- for(int a=0; a<OrdersTotal(); a++)
- {
- if(OrderSelect(a,SELECT_BY_POS)==true && OrderSymbol()==Symbol())
- {
- if(CountTrades333333(1,Symbol(),"",0)==0 && CountTrades333333(2,Symbol(),"",1)==0)
- text("无订单c",3,9,"Arial",clrDodgerBlue,"C:无订单",270, 120);
- if(CountTrades333333(1,Symbol(),"",0)!=0)
- text("多单c",3,9,"Arial",clrWhite,"C:多单 "+IntegerToString(orders333333(0))+"个 共计 "+DoubleToStr(CountTrades333333(1,Symbol(),"",0),2)+" 均价 "+DoubleToStr(AvgPrice333333(1,Symbol(),1),Digits),270, 120);
- if(CountTrades333333(2,Symbol(),"",1)!=0)
- text("空单c",3,9,"Arial",clrWhite,"C:空单 "+IntegerToString(orders333333(1))+"个 共计 "+DoubleToStr(CountTrades333333(2,Symbol(),"",1),2)+" 均价 "+DoubleToStr(AvgPrice333333(2,Symbol(),2),Digits),270, 120);
- if(CountTrades333333(1,Symbol(),"",0)+CountTrades333333(2,Symbol(),"",1)!=0)
- {
- if(跟踪距离!=0 && 均线跟踪开关3==1 && 跟踪品种==Symbol() && 跟踪周期==Period())
- text("跟踪运行c",3,9,"Arial",clrRed,周期显示+"周期__"+跟踪周期显示3+"均线__"+(string)跟踪距离+"点__跟踪止损,运行中",270, 100);
- else
- text("跟踪未启动c",3,9,"Arial",clrDimGray,"均线跟踪止损 未启动",270, 100);
- if(均线减仓开关3==1 && 减仓品种==Symbol() && 减仓周期==Period())
- {
- if(mark==0)
- text("减仓运行c",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示3+"均线__"+减仓仓位显示3+"减仓,运行中,",270, 80);
- if(mark!=0)
- text("减仓运行c1",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示3+"均线__"+减仓仓位显示3+"减仓,已成功!",270, 80);
- }
- else
- text("减仓未启动c",3,9,"Arial",clrDimGray,"均线减仓 未启动",270, 80);
- }
- }
- }
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 显示_所有组持仓_均价_跟踪_减仓()
- {
- ObjectDelete("无订单all");
- ObjectDelete("多单all");
- ObjectDelete("空单all");
- ObjectDelete("跟踪运行all");
- ObjectDelete("跟踪未启动all");
- ObjectDelete("减仓运行all");
- ObjectDelete("减仓运行all1");
- ObjectDelete("减仓未启动all");
- if(OrdersTotal()==0)
- text("无订单all",3,9,"Arial",clrDodgerBlue,"Total"+":无订单",270, 60);
- for(int a=0; a<OrdersTotal(); a++)
- {
- if(OrderSelect(a,SELECT_BY_POS)==true && OrderSymbol()==Symbol())
- {
- if(CountTrades(1,Symbol(),"",0)==0 && CountTrades(2,Symbol(),"",1)==0)
- text("无订单all",3,9,"Arial",clrDodgerBlue,"Total"+":无订单",270, 60);
- if(CountTrades(1,Symbol(),"",0)!=0)
- text("多单all",3,9,"Arial",clrDodgerBlue,"Total"+":多单 "+IntegerToString(orders(0))+"个 共计 "+DoubleToStr(CountTrades(1,Symbol(),"",0),2)+" 均价 "+DoubleToStr(AvgPrice(Symbol(),1),Digits),270, 60);
- if(CountTrades(2,Symbol(),"",1)!=0)
- text("空单all",3,9,"Arial",clrDodgerBlue,"Total"+ ":空单 "+IntegerToString(orders(1))+"个 共计 "+DoubleToStr(CountTrades(2,Symbol(),"",1),2)+" 均价 "+DoubleToStr(AvgPrice(Symbol(),2),Digits),270, 60);
- if(CountTrades(1,Symbol(),"",0)+CountTrades(2,Symbol(),"",1)!=0)
- {
- if(跟踪距离!=0 && 均线跟踪开关0==1 && 跟踪品种==Symbol() && 跟踪周期==Period())
- text("跟踪运行all",3,9,"Arial",clrRed,周期显示+"周期__"+跟踪周期显示0+"均线__"+(string)跟踪距离+"点__跟踪止损,运行中",270, 40);
- else
- text("跟踪未启动all",3,9,"Arial",clrDimGray,"均线跟踪止损 未启动",270, 40);
- if(均线减仓开关0==1 && 减仓品种==Symbol() && 减仓周期==Period())
- {
- if(mark==0)
- text("减仓运行all",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示0+"均线__"+减仓仓位显示0+"减仓,运行中,",270, 20);
- if(mark!=0)
- text("减仓运行all1",3,9,"Arial",clrRed,周期显示+"周期__"+减仓周期显示0+"均线__"+减仓仓位显示0+"减仓,已成功!",270, 20);
- }
- else
- text("减仓未启动all",3,9,"Arial",clrDimGray,"均线减仓 未启动",270, 20);
- }
- }
- }
- }
- //+------------------------------------------------------------------+
- //| 左侧显示 |
- //+------------------------------------------------------------------+
- void 显示_日期_时间_星期_品种_周期_点差()
- {
- ObjectDelete("日期");
- ObjectDelete("北京时间");
- ObjectDelete("品种+周期");
- ObjectDelete("买价");
- ObjectDelete("点差");
- ObjectDelete("卖价");
- int MarketSpread;
- MarketSpread=(int)MarketInfo(Symbol(),MODE_SPREAD);
- string week;
- if(DayOfWeek()==0)
- week="日";
- if(DayOfWeek()==1)
- week="一";
- if(DayOfWeek()==2)
- week="二";
- if(DayOfWeek()==3)
- week="三";
- if(DayOfWeek()==4)
- week="四";
- if(DayOfWeek()==5)
- week="五";
- if(DayOfWeek()==6)
- week="六";
- text("日期", 0,12,"微软雅黑",clrAqua,TimeToStr(TimeLocal(), TIME_DATE)+" 星期 "+week,90,0);
- text("北京时间", 0,48,"微软雅黑",clrAqua,TimeToStr(TimeLocal(), TIME_MINUTES|TIME_SECONDS),0,7);
- text("品种+周期", 0,24,"Arial",clrDodgerBlue,Symbol()+" "+周期显示,0, 90);
- text("买价", 0,18,"Arial",clrRed,DoubleToStr(Ask,Digits),0, 130);
- text("点差", 0,18,"Arial",Yellow,(string)MarketSpread,0, 160);
- text("卖价", 0,18,"Arial",0x00bb00,DoubleToStr(Bid,Digits),0, 190);
- }
- //+------------------------------------------------------------------+
- //| |
- //+------------------------------------------------------------------+
- void 按钮排版()
- {
- anniu1("closeall",C'255,255,255',90,75,"全部平仓",80);
- anniu1("delgua",clrWhite,90,108,"删除挂单",80);
- anniu("slm",clrWhite,90,141,"价格止损",80);
- anniu("tpm",clrWhite,90,207,"价格止盈",80);
- anniu1("close1/2",clrWhite,180,75,"平 1/2 仓",80);
- anniu("dlpb",clrWhite,180,108,"独立平保",80);
- anniu("dsslm",clrWhite,180,141,"点数止损",80);
- anniu("dstpm",clrWhite,180,207,"点数止盈",80);
- anniu1("close1/3",clrWhite,270,75,"平 1/3 仓",80);
- anniu("jjpb",clrWhite,270,108,"均价平保",80);
- anniu("jeslm",clrWhite,270,141,"金额止损",80);
- anniu("jetpm",clrWhite,270,207,"金额止盈",80);
- anniu1("gbgz",clrWhite,90,255,"关闭跟踪",80);
- anniu("anniuma3",clrWhite,90,319,"跟踪止损",80);
- anniu("anniuma2",clrWhite,90,352,"跟踪止损",80);
- anniu("anniuma1",clrWhite,90,385,"跟踪止损",80);
- anniu2("1/2_仓位",C'110,110,110',C'0,40,0',90,288,"1/2仓位 ",80,25);
- anniu2("2/3_仓位",C'110,110,110',C'0,40,0',180,288,"2/3仓位 ",80,25);
- anniu2("1/3_仓位",C'110,110,110',C'0,40,0',270,288,"1/3仓位 ",80,25);
- anniu1("buy_stop",clrWhite,180,431,"Buy Stop",80);
- anniu1("buy_limit",clrWhite,180,498,"Buy Limit",80);
- anniu1("sell_limit",clrWhite,90,431,"Sell Limit",80);
- anniu1("sell_stop",clrWhite,90,498,"Sell Stop",80);
- anniu("anniuma3_减仓",clrWhite,270,319,"均线减仓",80);
- anniu("anniuma2_减仓",clrWhite,270,352,"均线减仓",80);
- anniu("anniuma1_减仓",clrWhite,270,385,"均线减仓",80);
- anniu1("关闭减仓",clrWhite,270,255,"关闭减仓",80);
- anniu1("buy",clrWhite,270,431,"现 价 买",80);
- anniu1("sell",clrWhite,270,498,"现 价 卖",80);
- anniu2("A",clrWhite,C'0,40,0',270,20,"A",50,45);
- anniu2("B",clrWhite,C'0,40,0',210,20,"B",50,45);
- anniu2("C",clrWhite,C'0,40,0',150,20,"C",50,45);
- anniu2("T",clrWhite,C'0,40,0',90,20,"Total",80,45);
- }
- //+------------------------------------------------------------------+
- //| 按钮 绿色 |
- //+------------------------------------------------------------------+
- void anniu(string name,color yanse,int x,int y,string text,int changdu=0)
- {
- ObjectCreate(0,name,OBJ_BUTTON,0,0,0);
- ObjectSetInteger(0,name,OBJPROP_COLOR,yanse);//字颜色
- ObjectSetInteger(0,name,OBJPROP_BGCOLOR,clrDarkGreen);//按钮颜色
- ObjectSet(name,OBJPROP_BACK,false);//透明
- ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);//X位置
- ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);//Y位置
- if(changdu==0)//按钮自适应长度
- {
- int as=StringLen(text);
- ObjectSetInteger(0,name,OBJPROP_XSIZE,as*20);
- }
- else
- ObjectSetInteger(0,name,OBJPROP_XSIZE,changdu);
- ObjectSetInteger(0,name,OBJPROP_YSIZE,25);//按钮高度
- ObjectSetString(0,name,OBJPROP_FONT,"Arial");//字体
- ObjectSetString(0,name,OBJPROP_TEXT,text);//按钮文字
- ObjectSetInteger(0,name,OBJPROP_FONTSIZE,10);//字号
- //ObjectSetInteger(0,name,OBJPROP_BORDER_COLOR,clrOrange);//按钮边框颜色
- ObjectSet(name,OBJPROP_BORDER_TYPE,BORDER_FLAT);//弹起???
- ObjectSet(name,OBJPROP_STATE,false);//是否凹
- ObjectSet(name,OBJPROP_HIDDEN,true);
- ObjectSetInteger(0,name,OBJPROP_CORNER,1);
- }
- //+------------------------------------------------------------------+
- //| 按钮1 红色 |
- //+------------------------------------------------------------------+
- void anniu1(string name,color yanse,int x,int y,string text,int changdu=0)
- {
- ObjectCreate(0,name,OBJ_BUTTON,0,0,0);
- ObjectSetInteger(0,name,OBJPROP_COLOR,yanse);
- ObjectSetInteger(0,name,OBJPROP_BGCOLOR,clrMaroon);
- ObjectSet(name,OBJPROP_BACK,false);
- ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);
- ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);
- if(changdu==0)
- {
- int as=StringLen(text);
- ObjectSetInteger(0,name,OBJPROP_XSIZE,as*20);
- }
- else
- ObjectSetInteger(0,name,OBJPROP_XSIZE,changdu);
- ObjectSetInteger(0,name,OBJPROP_YSIZE,25);
- ObjectSetString(0,name,OBJPROP_FONT,"Arial");
- ObjectSetString(0,name,OBJPROP_TEXT,text);
- ObjectSetInteger(0,name,OBJPROP_FONTSIZE,10);
- //ObjectSetInteger(0,name,OBJPROP_BORDER_COLOR,clrOrange);
- ObjectSet(name,OBJPROP_BORDER_TYPE,BORDER_FLAT);
- ObjectSet(name,OBJPROP_STATE,false);//是否凹
- ObjectSet(name,OBJPROP_HIDDEN,true);
- ObjectSetInteger(0,name,OBJPROP_CORNER,1);
- }
- //+------------------------------------------------------------------+
- //| 按钮2 色1,色2,长,高 |
- //+------------------------------------------------------------------+
- void anniu2(string name,color yanse1,color yanse2,int x,int y,string text,int changdu,int gaodu)
- {
- ObjectCreate(0,name,OBJ_BUTTON,0,0,0);
- ObjectSetInteger(0,name,OBJPROP_COLOR,yanse1);//字颜色
- ObjectSetInteger(0,name,OBJPROP_BGCOLOR,yanse2);//按钮颜色
- ObjectSet(name,OBJPROP_BACK,false);//透明
- ObjectSetInteger(0,name,OBJPROP_XDISTANCE,x);//X位置
- ObjectSetInteger(0,name,OBJPROP_YDISTANCE,y);//Y位置
- ObjectSetInteger(0,name,OBJPROP_XSIZE,changdu);
- ObjectSetInteger(0,name,OBJPROP_YSIZE,gaodu);
- ObjectSetString(0,name,OBJPROP_FONT,"Arial");//字体
- ObjectSetString(0,name,OBJPROP_TEXT,text);//按钮文字
- ObjectSetInteger(0,name,OBJPROP_FONTSIZE,10);//字号
- //ObjectSetInteger(0,name,OBJPROP_BORDER_COLOR,clrOrange);//按钮边框颜色
- ObjectSetInteger(0,name,OBJPROP_BORDER_TYPE,BORDER_FLAT);//弹起???
- ObjectSet(name,OBJPROP_STATE,false);//是否凹
- ObjectSetInteger(0,name,OBJPROP_HIDDEN,true);
- ObjectSetInteger(0,name,OBJPROP_CORNER,1);
- }
- //+------------------------------------------------------------------+
- //| 文本框 |
- //+------------------------------------------------------------------+
- void shurukuang(string name, color yanse, int x, int y,int kuandu)
- {
- ObjectCreate(0,name,OBJ_EDIT,0,0,0) ;
- ObjectSetInteger(0, name, OBJPROP_XDISTANCE,x) ;
- ObjectSetInteger(0, name, OBJPROP_YDISTANCE,y) ;
- ObjectSetInteger(0, name, OBJPROP_XSIZE, kuandu) ;
- ObjectSetInteger(0, name, OBJPROP_YSIZE,25) ;
- ObjectSetInteger(0, name, OBJPROP_FONTSIZE,11) ;
- ObjectSetString(0,name,OBJPROP_FONT,"宋体");//字体
- ObjectSetInteger(0, name, OBJPROP_ALIGN, ALIGN_CENTER) ;
- ObjectSetInteger(0, name, OBJPROP_READONLY, false) ;
- ObjectSetInteger(0, name, OBJPROP_CORNER,1) ;
- ObjectSetInteger(0, name, OBJPROP_COLOR, clrWhite) ;
- ObjectSetInteger(0,name,OBJPROP_BORDER_COLOR,clrDarkGreen);
- ObjectSetInteger(0,name,OBJPROP_BGCOLOR,C'0,30,0');
- ObjectSetInteger(0,name,OBJPROP_BACK,false);
- ObjectSetString(0,name,OBJPROP_TEXT,"");
- }
复制代码 |
|