Edit Your Comment
EA - Increase lots don't work
Mar 07, 2015 at 09:33
(已编辑 Mar 06, 2015 at 18:32)
会员从Mar 06, 2015开始
1帖子
Hi everyone
I have a problem with my EA.
During the simulation the Lot% / profit do not change.
For example i have $ 1000 and i use 0.2Lots = $ 200 for 1max trade, the profit is $ 50 every 15Pips TP
So:
D1000,0.2minlot, MaxLot50, TP 15P = P50 €
D2000,0.2minlot, MaxLot50, TP 15P = P100 €
etc ... Right?
What i see During the simulation is, my profit does not change over time, even if the deposit is going up, and the minlot does not increase.
So after 1month of sim, if i have $ 2,000 with the same 0.2lots percentual, with this new deposit level, the new profits it should be more high, right?
But in my sim i have not this result, i have the same profit every operation.
How you can see on the attached First.gif image, in this First simulation, the MM work very well, but after i have reinstalled MT4, the new results with the new simulations are totaly different (how you can see on attached image After.gif) using the identic same config.
I have checked the code and for what i can see, seems the MM not turned on from other condition, but i can't fin why in the code.
You can also take the code of my EA on attached files.
Thx
I have a problem with my EA.
During the simulation the Lot% / profit do not change.
For example i have $ 1000 and i use 0.2Lots = $ 200 for 1max trade, the profit is $ 50 every 15Pips TP
So:
D1000,0.2minlot, MaxLot50, TP 15P = P50 €
D2000,0.2minlot, MaxLot50, TP 15P = P100 €
etc ... Right?
What i see During the simulation is, my profit does not change over time, even if the deposit is going up, and the minlot does not increase.
So after 1month of sim, if i have $ 2,000 with the same 0.2lots percentual, with this new deposit level, the new profits it should be more high, right?
But in my sim i have not this result, i have the same profit every operation.
How you can see on the attached First.gif image, in this First simulation, the MM work very well, but after i have reinstalled MT4, the new results with the new simulations are totaly different (how you can see on attached image After.gif) using the identic same config.
I have checked the code and for what i can see, seems the MM not turned on from other condition, but i can't fin why in the code.
You can also take the code of my EA on attached files.
Thx
会员从Nov 12, 2010开始
178帖子
Apr 17, 2015 at 09:50
会员从Nov 12, 2010开始
178帖子
Do you run the simulation with the default settings shown in the file or do you change some of them?
It would be more helpful to attach the .htm file generated from the test so we can see all inputs and the actual trades occurring. It is hard to guess at what is occurring in your code without stepping through it, so at least the .htm file would help indicate a little more of what is going on.
I think one possibility of what may be happening is that you are always taking the multiplier value of 2 with lastlot of 0.1 due to lots originally being 0.1 to get the 0.2 value that you are seeing from this line of code if you are setting martingale to true.
if(martingale && lastprofit<0)mlots=lastlot*multiplier;else mlots=lots;
It also seems like you need to improve the lotsoptimized function as I believe it is always returning a value less than 0.01 (minlots value) because your account balance is so small. If you have the following values
AccountBalance = 1000
lotsize = 10000 (based on your code)
minlot = 0.01
risk = 1
Then lot = 0.001 which is below your minlots value. You need to make a change to have this return a more realistic value.
double lotsoptimized(){
double lot;
if(stoploss>0)lot=AccountBalance()*(risk/100)/(stoploss*pt/MarketInfo(Symbol(),MODE_TICKSIZE)*MarketInfo(Symbol(),MODE_TICKVALUE));
else lot=NormalizeDouble((AccountBalance()/lotsize)*minlot*risk,lotdigits);
//lot=AccountFreeMargin()/(100.0*(NormalizeDouble(MarketInfo(Symbol(),MODE_MARGINREQUIRED),4)+5.0)/risk)-0.05;
return(lot);
It would be more helpful to attach the .htm file generated from the test so we can see all inputs and the actual trades occurring. It is hard to guess at what is occurring in your code without stepping through it, so at least the .htm file would help indicate a little more of what is going on.
I think one possibility of what may be happening is that you are always taking the multiplier value of 2 with lastlot of 0.1 due to lots originally being 0.1 to get the 0.2 value that you are seeing from this line of code if you are setting martingale to true.
if(martingale && lastprofit<0)mlots=lastlot*multiplier;else mlots=lots;
It also seems like you need to improve the lotsoptimized function as I believe it is always returning a value less than 0.01 (minlots value) because your account balance is so small. If you have the following values
AccountBalance = 1000
lotsize = 10000 (based on your code)
minlot = 0.01
risk = 1
Then lot = 0.001 which is below your minlots value. You need to make a change to have this return a more realistic value.
double lotsoptimized(){
double lot;
if(stoploss>0)lot=AccountBalance()*(risk/100)/(stoploss*pt/MarketInfo(Symbol(),MODE_TICKSIZE)*MarketInfo(Symbol(),MODE_TICKVALUE));
else lot=NormalizeDouble((AccountBalance()/lotsize)*minlot*risk,lotdigits);
//lot=AccountFreeMargin()/(100.0*(NormalizeDouble(MarketInfo(Symbol(),MODE_MARGINREQUIRED),4)+5.0)/risk)-0.05;
return(lot);
See my profile or message me for my latest EA
forex_trader_25447
会员从Dec 21, 2010开始
131帖子
Apr 17, 2015 at 11:58
会员从Dec 21, 2010开始
131帖子
Have you seen how much error/warnings you have ??? ... like this :
-> check operator precedence for possible error; use parentheses to clarify precedence
-> return value of 'OrderSelect' should be checked
-> declaration of 'lots' hides global declaration at line 6
-> not all control paths return a value
-> 'void' function returns a value
...0 error(s), 53 warning(s)
-> check operator precedence for possible error; use parentheses to clarify precedence
-> return value of 'OrderSelect' should be checked
-> declaration of 'lots' hides global declaration at line 6
-> not all control paths return a value
-> 'void' function returns a value
...0 error(s), 53 warning(s)
*商业用途和垃圾邮件将不被容忍,并可能导致账户终止。
提示:发布图片/YouTube网址会自动嵌入到您的帖子中!
提示:键入@符号,自动完成参与此讨论的用户名。