计算开仓量
来源:百度文库 编辑:神马文学网 时间:2024/06/06 04:06:02
double LotsOptimized()
{
double lots=0;
datetime max=0, x;
int l_count_8 = 0;
int ticket=-1;
double profit=0;
int li_0;
for (int l_pos_12 = 0; l_pos_12 {
if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY) == FALSE) break;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 12345 )
x = OrderOpenTime();
if (x > max)
{
ticket = OrderTicket();
max = x;
}
}
if (OrderSelect(ticket, SELECT_BY_TICKET) == false ) return;
lots= OrderLots();
profit=OrderProfit();if(profit>0)li_0=0;if(profit<0)li_0=1;
if(li_0==1)
{
if (open_pow_flag == true && lots lots = lots * open_pow_base;
if (open_pow_flag == false)lots=Lots;
}
if(li_0==0)lots = Lots;
return(lots);
}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~double LotsOptimized()
{
double lots=Lots;
datetime max=0, x;
int l_count_8 = 0;
int ticket=-1;
double profit=0;
int li_0;
for (int l_pos_12 = 0; l_pos_12 {
if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY) == true) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 12345 ){
x = OrderOpenTime();
if (x > max){ticket = OrderTicket();max = x;}
}
}
}
if (OrderSelect(ticket, SELECT_BY_TICKET) ==true )
{
lots= OrderLots();
profit=OrderProfit();
if(profit>0)li_0=0;
if(profit<0)li_0=1;
}
if(li_0==1)
{
if (open_pow_flag == true && lots if (open_pow_flag == false)lots=Lots;
}
if(li_0==0)lots = Lots;
return(lots);
}
{
double lots=0;
datetime max=0, x;
int l_count_8 = 0;
int ticket=-1;
double profit=0;
int li_0;
for (int l_pos_12 = 0; l_pos_12
if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY) == FALSE) break;
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 12345 )
x = OrderOpenTime();
if (x > max)
{
ticket = OrderTicket();
max = x;
}
}
if (OrderSelect(ticket, SELECT_BY_TICKET) == false ) return;
lots= OrderLots();
profit=OrderProfit();if(profit>0)li_0=0;if(profit<0)li_0=1;
if(li_0==1)
{
if (open_pow_flag == true && lots
if (open_pow_flag == false)lots=Lots;
}
if(li_0==0)lots = Lots;
return(lots);
}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~double LotsOptimized()
{
double lots=Lots;
datetime max=0, x;
int l_count_8 = 0;
int ticket=-1;
double profit=0;
int li_0;
for (int l_pos_12 = 0; l_pos_12
if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY) == true) {
if (OrderSymbol() == Symbol() && OrderMagicNumber() == 12345 ){
x = OrderOpenTime();
if (x > max){ticket = OrderTicket();max = x;}
}
}
}
if (OrderSelect(ticket, SELECT_BY_TICKET) ==true )
{
lots= OrderLots();
profit=OrderProfit();
if(profit>0)li_0=0;
if(profit<0)li_0=1;
}
if(li_0==1)
{
if (open_pow_flag == true && lots
}
if(li_0==0)lots = Lots;
return(lots);
}