按照MT4的例子 "STRINGS: ASCII CHARACTERS TABLE AND USE"
//+------------------------------------------------------------------+//| StringLowerCase |//+------------------------------------------------------------------+string StringLowerCase(string str)
{
string s = str;
int lenght = StringLen(str) - 1, symbol;
while(lenght >= 0)
{
symbol = StringGetChar(s, lenght);
if((symbol > 64 && symbol < 91) || (symbol > 191 && symbol < 224))
s = StringSetChar(s, lenght, symbol + 32);// тут possible loss of data due to type conversionelseif(symbol > -65 && symbol < -32)
s = StringSetChar(s, lenght, symbol + 288);// тут possible loss of data due to type conversion
lenght--;
}
return(s);
}
//+------------------------------------------------------------------+//| StringUpperCase |//+------------------------------------------------------------------+string StringUpperCase(string str)
{
string s = str;
int lenght = StringLen(str) - 1, symbol;
while(lenght >= 0)
{
symbol = StringGetChar(s, lenght);
if((symbol > 96 && symbol < 123) || (symbol > 223 && symbol < 256))
s = StringSetChar(s, lenght, symbol - 32);// тут possible loss of data due to type conversionelseif(symbol > -33 && symbol < 0)
s = StringSetChar(s, lenght, symbol + 224);// тут possible loss of data due to type conversion
lenght--;
}
return(s);
}
谢谢你,还有别的解决办法吗?此后,EA开仓并立即平仓。
你需要确定条件下的时间
并在平仓 前不刷新它。
然后从当前时间中减去你所记忆的时间
当给定的秒数过去后,关闭位置
我是这样做的
double op = CalculateProfit();
int time_waiting=0;
if (op >= Profit)
time_waiting = TimeLocal() + 10;
if (TimeLocal() < time_waiting)
{
CloseAll() 。
}
但它给了我一个错误
由于类型转换可能造成的数据损失
不是一个错误,而是一个警告:从一种类型转换到另一种类型时,数据可能会丢失。
datetime time_waiting;
也就是说,我不希望一看到2镑就关闭EA,而是要多一点。
什么,总是在10秒后利润更大?)
如果你不介意的话,请帮我解决这个问题...
接受对以下事实的全部责任
矮子
无符号 短类型 是ushort类型,它的大小也是2字节。最小值为0,最大值为65,535。
䵮䵮
整数int类型 的大小为4字节(32位)。最小值为-2 147 483 648,最大值为2 147 483 647。
我按你说的做了,但由于某些原因,在关闭后专家顾问关闭了几笔交易,尽管我在CloseAll()函数后有一小时的滑点。
double op = CalculateProfit()。
if (op >= Profit && LastTime == 0)
LastTime = TimeCurrent ();
if(LastTime > 0 &&TimeCurrent () - LastTime >= Second)
{
CloseAll();
LastTime = 0;
SendNotification("Trade is over");
Sleep(60*60000);// 60.000 = 1分钟
}