externint LotPercentage=10; // use 10% of balance as lot sizedouble LotInBalance=(LotPercentage/100)*AccountBalance(); // find the amount that is 10% of balance lets assume balance is $1000double Lot=LotInBalance/(MarketInfo(Symbol(), MODE_MARGINREQUIRED)) // divide as you said
externint LotPercentage=10; // use 10% of balance as lot sizedouble LotInBalance=(LotPercentage/100)*AccountBalance(); // find the amount that is 10% of balance lets assume balance is $1000double Lot=LotInBalance/(MarketInfo(Symbol(), MODE_MARGINREQUIRED)) // divide as you said
externint LotPercentage=10; // use 10% of balance as lot sizedouble LotInBalance=(LotPercentage/100)*AccountBalance(); // find the amount that is 10% of balance lets assume its $1000double LotUnits=LotBalance*AccountLeverage(); // multiply this 10% balance($100) by leverage to get lot unitsdouble lots=NormalizeDouble((LotUnits/100000),2); // expected to return 0.1/* divide this lot units by 100,000(standard lot size units) and normalize to 2 decimal places to get something like 0.1 if account balance is say $1000 for use in ordersend()*/
jameslarry: Hi i would like to calculate lots such that if say account balance is $1000 to open trades with $100 in other words 10% and when the balance grows to $2000 to open trades with $200. This is some sort of incremental system that should maintain lot size of new trades at 10% of balance. How do i go about it its nowhere in mql4 book.
它以你的账户货币返回。我在这里给了你一个附件https://www.mql5.com/en/forum/140034
这个附件是一个指标,我不知道从哪里开始,因为我对指标一无所知,我刚刚开始学习EA。
这个附件是一个指标,我不知道从哪里开始,因为我对指标一无所知,我刚刚开始学习EA。
好吧,有一个方法可以做到这一点。
打开你安装MetaTrader的文件夹(C:\Program Files\...) > 打开专家文件夹 > 打开指标文件夹,然后把附件移到或复制到那里。
好吧,有一个方法可以做到这一点。
打开你安装MetaTrader的文件夹(C:\Program Files\...) > 打开专家文件夹 > 打开指标文件夹,把附件移到或复制到那里。
我知道如何用metaeditor打开该文件。我下面的代码现在会返回0.1吗?还有,未经测试的风险代码会出现错误,即使我设置了5000美元的余额,你也无法负担最低手数。
是的,我知道如何用元编辑器打开文件。我下面的代码现在会返回0.1吗?
我不知道,因为我不知道MarketInfo(Symbol(), MODE_MARGINREQUIRED)的值,它取决于你的杠杆,以及你想交易的货币的当前价格。
我得走了,詹姆斯,我住在不同的时区,你知道吗?
:D
杠杆率是1:100,我也希望它能在不同的杠杆率上工作。
现在1手欧元兑美元的成本--我想--大约是1268.78美元。有足够的计算,更安全。
它仍然给出了错误。我只想从余额中获得手数,不管它是否安全,我认为AccountBalance在策略测试器上 不起作用。有什么方法可以在图表中输出手数,以便我知道它的回报?
jameslarry:
Hi i would like to calculate lots such that if say account balance is $1000 to open trades with $100 in other words 10% and when the balance grows to $2000 to open trades with $200. This is some sort of incremental system that should maintain lot size of new trades at 10% of balance. How do i go about it its nowhere in mql4 book.
那么100美元是你的风险吗?或者你想用100美元的保证金?
它仍然给出了错误。我只想从余额中获得手数,不管它是否安全,我认为AccountBalance在策略测试器上不起作用。是否有办法在图表中输出手数,以便我可以知道它的返回值?