任何菜鸟问题,为了不给论坛添乱。专业人士,不要路过。没有你就无处可去 - 6. - 页 237

 

你好,各位程序员。

我懒得去看教程了。也许你知道在你的专家顾问中应该做什么改变,以便它能以0.01的步长而不是0.1的步长进行资金管理。

附加的文件:
 
SteelKnight84:

你好,各位程序员。

我懒得去看教程了。也许你知道在你的专家顾问中应该做什么改变,以便它能在0.01而不是0.1时应用资金管理。


每个人都太懒了
 
Vinin:

每个人都是懒惰的

对于一个懂得语言的程序员来说,懒得打开程序是一回事。当一个不懂语言的人懒得学习语言来回答一个本质上简单的问题时,这又是另一回事。如果了解语言是一个程序员的必需品,那么我潜心研究它就没有意义了:)这就是全部。但当然,如果没有人回答,我就得回答。但是,如果只有程序员在这里交流,那么这个论坛的意义何在?
 
SteelKnight84:

对于一个懂得语言的程序员来说,懒得打开程序是一回事。当一个不懂语言的人懒得学习语言来回答一个本质上简单的问题时,这又是另一回事。如果了解语言是一个程序员的必需品,那么我潜心研究它就没有意义了:)这就是全部。但当然,如果没有人回答,我就得回答。但是,如果只有程序员在这里交流,这个论坛的意义何在?

如果没有意义--不要问问题,而是直接在这里 问。
 
Vinin:

如果没有意义,就不要问了,直接来这里

谢谢你。
 
SteelKnight84:

你好,各位程序员。

我懒得去看教程了。也许你知道在你的专家顾问中应该做什么改变,以便它能以0.01的步长而不是0.1的步长进行资金管理。


我改了2个数字,看看是否能正常工作。

附加的文件:
 

是否有一个选项可以将整个论坛标记为已读?

还有MQL5论坛...

谢谢你

 
ALXIMIKS:


改变了2个数字,看看它是否能正常工作。


事实证明,有人并不懒惰。我犯了一个错误。
 

大家好!!!。谢谢大家的合理建议。但我还是没能在我开始的事情上取得任何进展))我的EA开了两个相同的订单,其余的都是反对运动的,我想把它改成在运动中开仓!!。我已经尝试了所有的变种。

请告知谁可以

string GLOB_START;

int init()
{
GLOB_START = "@" + DoubleToStr(ID,0) + "@" +"_start" 。
if !GlobalVariableCheck( GLOB_START )GlobalVariableSet( GLOB_START,TimeCurrent())。
return(0);
}

int deinit()
{
switch( UninitializeReason() )
{
caseREASON_REMOVE: delete_glob ( "@" + DoubleToStr(ID,0) + "@" ) 。
}
if ( IsTesting() )delete_glob ( "@" + DoubleToStr(ID,0) + "@" )。
return(0);
}

void delete_glob ( string c )
{
int i;
for ( i = GlobalVariablesTotal()-1; i>= 0; i-- )if ( StringFind(GlobalVariableName(i),c) >= 0 ) GlobalVariableDel(GlobalVariableName(i))
}

int start()
{
评论(Info())。
int KOL_BUY = order_total(0);
int KOL_SELL = order_total(1);
双L。

if ( order_total() == 0 )
{
open(0,Lot,0,TP)。
open(1,Lot,0,TP)。
}

如果 ( KOL_BUY == 0 && KOL_SELL != 0 )
{
open(0,Lot,0,TP)。
l = last_trade(1);
open(1,l,0,0);
modify_orders(1);
}

如果 ( KOL_BUY != 0 && KOL_SELL == 0 )
{
open(1,Lot,0,TP)。
l = last_trade(0);
open(0,l,0,0)。
modify_orders(0);
}

return(0);
}

字符串 Info()
{
int i;
double buff_1 = 0, buff_2 = 0, buff_3 = 0。
string res = "\n";

for( i = OrdersHistoryTotal() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)。
如果( OrderMagicNumber() == ID )
{
if ( OrderOpenTime() >= iTime(NULL,PERIOD_D1,0) )buff_1 += OrderProfit()。
if ( OrderOpenTime() >= iTime(NULL,PERIOD_D1,1) && OrderOpenTime() < iTime(NULL,PERIOD_D1,0) ) buff_2 += OrderProfit()。
if ( OrderOpenTime() >= GlobalVariableGet(GLOB_START) )buff_3 += OrderProfit()。
}
}

res = res + "以存款货币计算的利润" + TimeToStr(iTime(NULL,PERIOD_D1,0)) + ": " + DoubleToStr(buff_1,0) + "\n" + "\n"。
res = res + "Profit in deposit currency for " + TimeToStr(iTime(NULL,PERIOD_D1,1)) + ": " + DoubleToStr(buff_2,0) + "n" + "n" 。
res = res + "存款货币的利润总额:" + DoubleToStr(buff_3,0) + "n"。
return(res)。
}

void modify_orders ( int type )
{
int i;
datetime time_last = 0, time_first = TimeCurrent();
double SPREAD = MarketInfo(Symbol(),MODE_SPREAD)*MarketInfo(Symbol(),MODE_POINT), op_pr_last, op_pr_first, level;

for( i = OrdersTotal() - 1; i >= 0; i-- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES)。
如果( OrderMagicNumber() == ID && OrderType() == type )
{
如果 ( OrderOpenTime() > time_last )
{
op_pr_last = OrderOpenPrice()。
time_last = OrderOpenTime()。
}
如果 ( OrderOpenTime() < time_first )
{
op_pr_first = OrderOpenPrice()。
time_first = OrderOpenTime()。
}
}
}


if ( type == 0 )level = op_pr_last + MathAbs(op_pr_last-op_pr_first) * (SL/100);
if ( type == 1 )level = op_pr_last - MathAbs(op_pr_last-op_pr_first) * (SL/100);

for( i = OrdersTotal() - 1; i >= 0; i -- )
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES)。
if( OrderMagicNumber() == ID && OrderType() == type && NormalizeDouble(OrderTakeProfit(),Digits) != NormalizeDouble(level,Digits) )OrderModify(OrderTicket(),OrderOpenPrice(), OrderStopLoss(),level,0)
}
}

double last_trade( int t )
{
int i;
double res = -1;
datetime time=0。

for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES)。
如果(OrderOpenTime()>time && OrderMagicNumber()==ID && OrderType() ==t)
{
res = OrderLots()。
time = OrderOpenTime()。
}
}
if ( multiplier ) return(res * Lot_koeff);
if ( !multiplier )return(res + Lot_koeff);
}
int open(int type, double l, double sl=0, double tp=0, string comm = "" )
{
int isOpened = 0, try = 0;
双重的S,T。
while ( IsTradeContextBusy() ){Sleep(500);}.
RefreshRates()。
if ( sl != 0 && sl < MarketInfo(Symbol(),MODE_STOPLEVEL) )sl = MarketInfo(Symbol(),MODE_STOPLEVEL) 。
if ( tp != 0 && tp < MarketInfo(Symbol(),MODE_STOPLEVEL) )tp = MarketInfo(Symbol(),MODE_STOPLEVEL) 。
if ( type == 0 )
{
如果( tp == 0 )t = 0。
if ( tp != 0 )t = Ask + tp * Point;
如果( sl == 0 )s = 0。
if ( sl != 0 ) s = Bid - sl * Point;
}
if ( type == 1 )
{
如果( tp == 0 )t = 0。
if ( tp != 0 )t = Bid - tp * Point;
如果( sl == 0 )s = 0。
if ( sl != 0 )s = Ask + sl * Point;
}
s = NormalizeDouble(s,Digits);
t = NormalizeDouble(t,Digits)。
如果(type==0)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Ask,Digits),10,s,t,comm,ID)。
如果(type==1)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Bid,Digits),10,s,t,comm,ID)。
睡眠(500)。
while(isOpened<0)
{
while ( IsTradeContextBusy() ){Sleep(500);}.
RefreshRates()。
if ( type == 0 )
{
如果( tp == 0 )t = 0。
if ( tp != 0 )t = Bid + tp * Point;
如果( sl == 0 )s = 0。
if ( sl != 0 ) s = Bid - sl * Point;
}
if ( type == 1 )
{
如果( tp == 0 )t = 0。
if ( tp != 0 )t = Ask - tp * Point;
如果( sl == 0 )s = 0。
if ( sl != 0 )s = Ask + sl * Point;
}
s = NormalizeDouble(s,Digits);
t = NormalizeDouble(t,Digits)。
try++。
如果(type==0)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Ask,Digits),10,s,t,comm,ID)。
如果(type==1)isOpened = OrderSend(Symbol(),type,check_lot(l),NormalizeDouble(Bid,Digits),10,s,t,comm,ID)。
if(try > 5) break;
if(isOpened>=0)break;
睡眠(500)。
}
if(isOpened<0) Alert("Order not opened, error :", GetLastError())。
return(isOpened)。
}

int order_total ( int type_1 = -1, int type_2 = -1 )
{
int i;
int kol=0。
for(i=OrdersTotal()-1;i>=0;i--)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES)。
如果(OrderMagicNumber()==ID && (OrderType() == type_1 || OrderType() == type_2))kol++。
if(OrderMagicNumber()==ID && type_1 ==-1 && type_2 ==-1 )kol++;
}
返回(kol)。
}

double check_lot(double &lo)
{
double l = MarketInfo(Symbol(),MODE_LOTSTEP);
int ok = 0。
while ( l < 1 ){l*=10;ok++; }
if( lo < MarketInfo(Symbol(),MODE_MINLOT) )lo = MarketInfo(Symbol(),MODE_MINLOT) 。
if( lo > MarketInfo(Symbol(),MODE_MAXLOT) )lo = MarketInfo(Symbol(),MODE_MAXLOT) 。
返回(NormalizeDouble(lo,ok))。

 

你能建议以下事情吗,账户上有N个EA,在一定条件下都可以同时开出 一个订单,每个人在账户上检查的订单不超过1个,但有时我最终会有N个订单,我该怎么做?