单量风险控制
#property copyright shiyingpan
#property link https://aijy.github.io
#property version 1.00
#property strict
input double 万美金最大单量=2; //--- 一万美金可下几首单量,按比例缩减
bool new_orders=true;
double max_lots=0;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int onInit()
{
while(AccountNumber()==0)
Sleep(10000);
max_lots=AccountEquity()/10000*万美金最大单量;
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void onDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void onTick()
{
double total_lots=0;
for(int i=OrdersTotal()-1;i i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
total_lots=total_lots+OrderLots();
}
}
if(total_lots max_lots)
{
new_orders=false;
}
if(new_orders==true)
{
Print( 当前单量未超最大单量,允许下单
}
}复制代码
#property link https://aijy.github.io
#property version 1.00
#property strict
input double 万美金最大单量=2; //--- 一万美金可下几首单量,按比例缩减
bool new_orders=true;
double max_lots=0;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int onInit()
{
while(AccountNumber()==0)
Sleep(10000);
max_lots=AccountEquity()/10000*万美金最大单量;
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void onDeinit(const int reason)
{
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void onTick()
{
double total_lots=0;
for(int i=OrdersTotal()-1;i i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
total_lots=total_lots+OrderLots();
}
}
if(total_lots max_lots)
{
new_orders=false;
}
if(new_orders==true)
{
Print( 当前单量未超最大单量,允许下单
}
}复制代码
打赏
最新创建圈子
- 新闻EA运行效果图圈 2020-01-01
圈主:admin 帖子:1