Pour utiliser le chat, veuillez vous connecter.
Retour aux contacts

EA - Increase lots don't work

Mar 07, 2015 at 09:33
Vues 553
2 Replies
Membre depuis Mar 06, 2015   posts 1
Mar 07, 2015 at 09:33 (édité Mar 06, 2015 at 18:32)
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

Fichiers joints:

Membre depuis Nov 12, 2010   posts 174
Apr 17, 2015 at 09:50
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);

See my profile or message me for my latest EA
forex_trader_25447
Membre depuis Dec 21, 2010   posts 131
Apr 17, 2015 at 11:58
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)

Se connecter / S’inscrire to comment
You must be connected to Myfxbook in order to leave a comment
*Lutilisation commerciale et le spam ne seront pas tolérés et peuvent entraîner la fermeture du compte.
Conseil : Poster une image/une url YouTube sera automatiquement intégrée dans votre message!
Conseil : Tapez le signe @ pour compléter automatiquement un nom dutilisateur participant à cette discussion.