顺水外汇EA交易网MT4
标题:
望论坛高手大大拔刀相助
[打印本页]
作者:
wdnpy485
时间:
2018-1-11 13:20
标题:
望论坛高手大大拔刀相助
论坛搜了一个盈亏统计的小指标,和自己预期的有点差别,无奈没编程的技术功底,只能发出江湖求助令了。
只统计当前窗口的货币,需要的功能很简单:
多单手数,,多单盈利,,
空单手数,,空单盈利,,
净持仓量,,浮动盈亏,,
[C++] 纯文本查看 复制代码#property copyright " "
#property link " "
#property indicator_chart_window
extern color 颜色=Yellow;
extern int 字号=12;
////////////////////////////////////////////
int init() { return(0); }
///////////////////////////////////////////
int deinit() { return(0); }
//////////////////////////////////////////
int start()
{
ObjectSet("text", OBJPROP_CORNER, 50);
ObjectSet("text", OBJPROP_XDISTANCE, 450);
ObjectSet("text", OBJPROP_YDISTANCE, 1);
string name_0 = "yl";
string name_16 = "yl0";
string name_24 = "yl1";
string name_32 = "yl2";
string name_40 = "yl3";
string name_48 = "yl4";
string name_56 = "yl5";
string name_64 = "yl6";
string name_72 = "yl7";
double ld_56 = 0;
double ld_64 = 0;
double ld_87 = 0; //多单盈利
double ld_88 = 0; //空单盈利
double ld_89 = 0; //总盈利
double ld_96 = 0;
double ld_97 = 0;
double ld_104 = 0;
double ld_105 = 0;
double ld_116 = 0;
double ld_117 = 0;
double ld_118 = 0;
//当前统计
int li_53 = OrdersTotal();
for (int pos_48 = li_53 - 1; pos_48 >= 0; pos_48--) {
OrderSelect(pos_48, SELECT_BY_POS, MODE_TRADES);
ld_89 += OrderProfit(); //+OrderCommission()+OrderSwap()
if(OrderSymbol() == Symbol()){
ld_88 += OrderProfit();
double buy,sell;
if (OrderType() == OP_BUY) { buy += OrderLots(); ld_87 += OrderProfit(); }
if (OrderType() == OP_SELL){ sell += OrderLots(); ld_88 += OrderProfit();}
double cha = buy - sell;
}
}
//统计当前持有单的盈亏状况
string text_8 ="多单手数:" + DoubleToStr(buy, 2)+" , "+"多单盈利:" + DoubleToStr(ld_87, 2)+";";
ObjectCreate(name_32, OBJ_LABEL, 0, 0, 0);
ObjectSetText(name_32, text_8, 字号, "Times New Roman", 颜色);
ObjectSet(name_32, OBJPROP_CORNER, 0);
ObjectSet(name_32, OBJPROP_XDISTANCE, 10);
ObjectSet(name_32, OBJPROP_YDISTANCE, 30);
text_8 ="空单手数:" + DoubleToStr(sell, 2)+" , "+ "空单盈利:" + DoubleToStr(ld_88, 2)+";";
ObjectCreate(name_56, OBJ_LABEL, 0, 0, 0);
ObjectSetText(name_56, text_8, 字号, "Times New Roman", 颜色);
ObjectSet(name_56, OBJPROP_CORNER, 0);
ObjectSet(name_56, OBJPROP_XDISTANCE, 10);
ObjectSet(name_56, OBJPROP_YDISTANCE, 50);
text_8 ="净持仓量:" + DoubleToStr(cha, 2)+" , "+ "浮动盈亏:" + DoubleToStr(ld_89, 2)+";";
ObjectCreate(name_64, OBJ_LABEL, 0, 0, 0);
ObjectSetText(name_64, text_8, 字号, "Times New Roman", 颜色);
ObjectSet(name_64, OBJPROP_CORNER, 0);
ObjectSet(name_64, OBJPROP_XDISTANCE, 10);
ObjectSet(name_64, OBJPROP_YDISTANCE, 70);
return (0);
}
//+------------------------------------------------------------------+
望各路编程达人,高手,大师,天尊拔刀相助
有合适指标的江湖人士分享也是可以的
作者:
764352966@qq.co
时间:
2018-1-11 14:12
无图无真相
作者:
winson_h
时间:
2018-1-11 14:49
小手一抖,金币到手
作者:
haitao
时间:
2018-1-11 15:49
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
作者:
dongmu
时间:
2018-1-11 15:58
小手一抖,金币到手
作者:
fu416600722
时间:
2018-1-11 16:20
抖一抖手
作者:
ccachilles
时间:
2018-1-11 17:33
狙击手指标下载双线MACD三线KDJ维加斯隧道顾比均线蝴蝶指标
http://bbs.520fx.com/forum.php?m ... &fromuid=110978
(出处: 智慧投资网-520FX)
作者:
ghbnny
时间:
2018-1-11 18:35
小手一抖,金币到手
作者:
sanli83
时间:
2018-1-11 19:10
不太理解,想寻找更好的指标,希望与同大家分享
作者:
和谐机车
时间:
2018-1-11 19:35
小手一抖,金币到手
作者:
灵猴献瑞
时间:
2018-1-11 20:33
路过进来看看,赚点金币
作者:
kuangren90
时间:
2018-1-11 21:32
谢谢分享,学编程,学交易,实现程序化交易。
作者:
wvhui
时间:
2018-1-11 22:05
小手一抖,金币到手
欢迎光临 顺水外汇EA交易网MT4 (http://waterforex.com/)
Powered by Discuz! X3.2