根据账户余额计算开仓手数

楼主  收藏   举报   帖子创建时间:  2019-05-05 12:20 回复:0 关注量:746
该函数根据账户余额动态计算开仓手数。

  1. int LotSize()
  2. // The function opens a short position with lot size=volume
  3. {
  4. if (AccountBalance()>=50) lot=0.02;
  5. if (AccountBalance()>=100) lot=0.04;
  6. if (AccountBalance()>=200) lot=0.08;
  7. if (AccountBalance()>=300) lot=0.12;
  8. if (AccountBalance()>=400) lot=0.16;
  9. if (AccountBalance()>=500) lot=0.2;
  10. if (AccountBalance()>=600) lot=0.24;
  11. if (AccountBalance()>=700) lot=0.28;
  12. if (AccountBalance()>=800) lot=0.32;
  13. if (AccountBalance()>=900) lot=0.36;
  14. if (AccountBalance()>=1000) lot=0.4;
  15. if (AccountBalance()>=1500) lot=0.6;
  16. if (AccountBalance()>=2000) lot=0.8;
  17. if (AccountBalance()>=2500) lot=1.0;
  18. if (AccountBalance()>=3000) lot=1.2;
  19. if (AccountBalance()>=3500) lot=1.4;
  20. if (AccountBalance()>=4000) lot=1.6;
  21. if (AccountBalance()>=4500) lot=1.8;
  22. if (AccountBalance()>=5000) lot=2.0;
  23. if (AccountBalance()>=5500) lot=2.2;
  24. if (AccountBalance()>=6000) lot=2.4;
  25. if (AccountBalance()>=7000) lot=2.8;
  26. if (AccountBalance()>=8000) lot=3.2;
  27. if (AccountBalance()>=9000) lot=3.6;
  28. if (AccountBalance()>=10000) lot=4.0;
  29. if (AccountBalance()>=15000) lot=6.0;
  30. if (AccountBalance()>=20000) lot=8.0;
  31. if (AccountBalance()>=30000) lot=12;
  32. if (AccountBalance()>=40000) lot=16;
  33. if (AccountBalance()>=50000) lot=20;
  34. if (AccountBalance()>=60000) lot=24;
  35. if (AccountBalance()>=70000) lot=28;
  36. if (AccountBalance()>=80000) lot=32;
  37. if (AccountBalance()>=90000) lot=36;
  38. if (AccountBalance()>=100000) lot=40;
  39. if (AccountBalance()>=200000) lot=80;
  40. }
打赏