论坛全局菜单下方 - TICKMILL 285X70论坛全局菜单下方 - ThinkMarkets285X70论坛全局菜单下方 - 荔枝返现285X70论坛全局菜单下方 -  icmarkets285X70
查看:420回复:6
龙门石窟
注册时间2017-12-27
[求助]怎么修改这个脚本的最低下单手数
楼主发表于:2018-03-03 09:10只看该作者倒序浏览
1楼 电梯直达
电梯直达
网上找到的脚本,下单最低手数0.1,怎么改成0.01,先谢谢了。 //+---------------------------------------------+ //| BatchOpen.mq4 | //| [email protected] | //| www.talkfx.com | //+---------------------------------------------+ #property copyright "[email protected]" #property link "www.talkfx.com" #property show_inputs #include extern bool ActionBuy = true; extern double RangeStart = 1.1850; extern double RangeEnd = 1.1870; extern double TotalLots = 1.0; extern int OrderCount = 5; extern int Slippage = 0; extern double StopLoss = 0.0; extern double TakeProfit = 0.0; extern string Comments = "BatchOpen Auto Generated"; extern datetime Expiration = 0; extern int Delay = 0; #define BATCH_OPEN_MAGIC 06021610 //+---------------------------------------------+ //|script program start function | //+---------------------------------------------+ int ActionType = 0; int start() { //---- //inputs checking if (OrderCount < 2) { MessageBox("Not enough OrderCount, must be greater than 1 at least"); return (-1); } double LotsPerOrder, LotsLeft; int i, n; n = TotalLots * 10/OrderCount; LotsPerOrder = n; LotsPerOrder /= 10; LotsLeft = TotalLots - LotsPerOrder * OrderCount; if (LotsPerOrder < 0.1) { MessageBox("Not enough TotalLots or too many OrderCount, each order must be 0.1 lots at least"); return (-1); } if (LotsPerOrder + LotsLeft >= 10000) { MessageBox("Too many TotalLots, each order must be less than 10000 lots"); return (-1); } n = NormalizeDouble((MathAbs(RangeStart - RangeEnd) * MathPow(10, Digits)), 0)/(OrderCount-1); if (n < 1) { MessageBox("Too many OrderCount, each order must have 1 pips diff at least"); } double volume, price; string symbol; int cmd, magic, ticket, cnt, failed; symbol = Symbol(); magic = BATCH_OPEN_MAGIC; volume = LotsPerOrder; cnt = 0; failed = 0; for (i = 0; i < OrderCount; i++) { price = RangeStart + i * n * Point; if (i == OrderCount-1) { volume += LotsLeft; //price = RangeEnd; } RefreshRates(); if (ActionBuy) { if (price < Ask) { cmd = OP_BUYLIMIT; } else { cmd = OP_BUYSTOP; } } else { if (price < Bid) { cmd = OP_SELLSTOP; } else { cmd = OP_SELLLIMIT; } } ticket = OrderSend(symbol, cmd, volume, price, Slippage, StopLoss, TakeProfit, Comments, magic, Expiration, CLR_NONE); if (ticket < 0) { Print("Failed to place order at price " + price + ", Error: " + ErrorDescription(GetLastError())); failed++; } else { cnt++; } Sleep(Delay); } //---- Print(cnt + " orders placed, " + OrderCount + " requested, " + failed + " failed"); return(0); } //+---------------------------------------------+
TK29帖子1楼右侧xm竖版广告90-240
个性签名

韬客社区www.talkfx.co

广告
TK30+TK31帖子一樓廣告
TK30+TK31帖子一樓廣告
hizz
注册时间2015-06-14
发表于:2018-03-03 12:13只看该作者
2楼
LotsPerOrder /= 10; 这个代码的意思是要分10份,所以,就算把这个代码 LotsPerOrder < 0.1 从 0.1 改成 0.01 依然跑不掉要有0.1手。 但你可以试试开个美分账户,这样就能用更小的下单量跑了。
龙门石窟
注册时间2017-12-27
楼主发表于:2018-03-03 13:19只看该作者
3楼
hizz 发表于 2018-3-3 20:13
LotsPerOrder /= 10; 这个代码的意思是要分10份,所以,就算把这个代码 LotsPerOrder < 0.1
谢谢回复,如果能改是最好了
scalping
注册时间2015-01-14
发表于:2018-03-04 00:57只看该作者
4楼
本帖最后由 scalping 于 2018-3-4 09:04 编辑 TotalLots/OrderCount 1.0/5=0.2,挂5个单,加起来到1手,就是说每个单是0.2手。就是这个个关系。 修改TotalLots参数为0.05,不用改程序。只能帮你到这儿。
OximoO
注册时间2017-12-22
发表于:2018-03-04 01:49只看该作者
5楼
n = TotalLots * 10/OrderCount; LotsPerOrder = n; LotsPerOrder /= 10; LotsLeft = TotalLots - LotsPerOrder * OrderCount; ----------------------------- 不明白 n = TotalLots * 10/OrderCount; LotsPerOrder = n; 推出: LotsPerOrder =TotalLots * 10/OrderCount; LotsPerOrder /= 10; 推出: LotsPerOrder =TotalLots /OrderCount; LotsLeft = TotalLots - LotsPerOrder * OrderCount; 推出 LotsLeft = TotalLots - TotalLots /OrderCount * OrderCount; 推出 LotsLeft =TotalLots - TotalLots 推出 LotsLeft =0 LotsLeft 恒等于0 LotsLeft 什么鬼
OximoO
注册时间2017-12-22
发表于:2018-03-04 02:01只看该作者
6楼
int i, n; n = TotalLots * 10/OrderCount; LotsPerOrder = n; LotsPerOrder /= 10; LotsLeft = TotalLots - LotsPerOrder * OrderCount; if (LotsPerOrder < 0.1) { MessageBox("Not enough TotalLots or too many OrderCount, each order must be 0.1 lots at least"); return (-1); } if (LotsPerOrder + LotsLeft >= 10000) { ---------------------- n是整数 LotsLeft 是 n个订单之后剩余的不够一单的数量 算这个没有什么意义 删了就是 下面: int i; LotsPerOrder = TotalLots /OrderCount; if (LotsPerOrder < 0.01) { MessageBox("Not enough TotalLots or too many OrderCount, each order must be 0.1 lots at least"); return (-1); } if (LotsPerOrder >= 10000) {
龙门石窟
注册时间2017-12-27
楼主发表于:2018-03-04 04:24只看该作者
7楼
谢楼上两位
个性签名

韬客社区www.talkfx.co

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;

2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;

3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;

4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;

5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

版权所有:韬客外汇论坛 www.talkfx.com 联络我们:[email protected]