what happens in my code,its simple code for modify lot size,i give you 1 example if account balance is <10000 lot size = 0.1,then if account balance < 9900 lot size=0.2 etc etc...... thank you
- Array measurement
- Dot
- Emulation of deposits and withdrawals
the code does not trade the programmed lotsize???thank you
the entry signal is not there,my problem is only to modify lotsize in accord with account balance thank you
switch (lotsize) { case 1 : Lot=Lot; break; case 2 : Lot=Lot*2; break; case 3 : Lot=Lot*3; break; case 4 : Lot=Lot*4; break; case 5 : Lot=Lot*5; break; case 6 : Lot=Lot*6; break; default: Lot=Lot; break; }
It needs to break out of the switch when it finds a match also you can use default in case none of them match.
Here are my beliefs, bare with me a bit... I would create a function that could be flexible enough for the trade to leave the EA unattended. Use a percentage of the balance for the trade of use other equation for that automated purpose. Call this function whenever you need it and it will return a lot size to be used.
A piece of code:
Lots=RiskCapital/100*AccountBalance()/(TakeProfit*pipMultiplier*MarketInfo(Symbol(),MODE_TICKVALUE)*pipMultiplier);
That is the calculation using Percentage...
riskoff: what happens in my code,its simple code for modify lot size,i give you...
double Lot = 0.1; : case 2 : Lot=Lot*2; break;
- The first time you change Lot to 0.2 and open
- The second (assuming balance hasn't changed the case) you change Lot to 0.4
- The third time you change Lot to 0.8 ...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register