该函数根据账户余额动态计算开仓手数。
- int LotSize()
- // The function opens a short position with lot size=volume
- {
- if (AccountBalance()>=50) lot=0.02;
- if (AccountBalance()>=100) lot=0.04;
- if (AccountBalance()>=200) lot=0.08;
- if (AccountBalance()>=300) lot=0.12;
- if (AccountBalance()>=400) lot=0.16;
- if (AccountBalance()>=500) lot=0.2;
- if (AccountBalance()>=600) lot=0.24;
- if (AccountBalance()>=700) lot=0.28;
- if (AccountBalance()>=800) lot=0.32;
- if (AccountBalance()>=900) lot=0.36;
- if (AccountBalance()>=1000) lot=0.4;
- if (AccountBalance()>=1500) lot=0.6;
- if (AccountBalance()>=2000) lot=0.8;
- if (AccountBalance()>=2500) lot=1.0;
- if (AccountBalance()>=3000) lot=1.2;
- if (AccountBalance()>=3500) lot=1.4;
- if (AccountBalance()>=4000) lot=1.6;
- if (AccountBalance()>=4500) lot=1.8;
- if (AccountBalance()>=5000) lot=2.0;
- if (AccountBalance()>=5500) lot=2.2;
- if (AccountBalance()>=6000) lot=2.4;
- if (AccountBalance()>=7000) lot=2.8;
- if (AccountBalance()>=8000) lot=3.2;
- if (AccountBalance()>=9000) lot=3.6;
- if (AccountBalance()>=10000) lot=4.0;
- if (AccountBalance()>=15000) lot=6.0;
- if (AccountBalance()>=20000) lot=8.0;
- if (AccountBalance()>=30000) lot=12;
- if (AccountBalance()>=40000) lot=16;
- if (AccountBalance()>=50000) lot=20;
- if (AccountBalance()>=60000) lot=24;
- if (AccountBalance()>=70000) lot=28;
- if (AccountBalance()>=80000) lot=32;
- if (AccountBalance()>=90000) lot=36;
- if (AccountBalance()>=100000) lot=40;
- if (AccountBalance()>=200000) lot=80;
- }
|