How to open trade with 50% balance?

 

Hello,


maybe someone knows how to insert and what kind of code to insert to my EA so it would be able to open trades with 50% of current balance?


for example: I attach my ea, when conditions are good it opens trade with some lot size which will be a half of my current balance, than if it losses it will open a new trade (when another conditions are good to open trade) with another some kind of lot size of half my current balance. And the same half balance open on wining trades...


Thank You!

 
PIPEC:

Hello,

maybe someone knows how to insert and what kind of code to insert to my EA so it would be able to open trades with 50% of current balance?

The only part of your balance that is "used" when you place an Order is that needed to pay the Spread . . . you cannot "open trades with 50% of current balance". You can risk 50% of your balance if you have a fixed Stop Loss or know where you will close your Order, then you can use this information to calculate your position size . . . if this is what you want then search the forum, it's been discussed many, many times.
 
RaptorUK:
The only part of your balance that is "used" when you place an Order is that needed to pay the Spread . . . you cannot "open trades with 50% of current balance". You can risk 50% of your balance if you have a fixed Stop Loss or know where you will close your Order, then you can use this information to calculate your position size . . . if this is what you want then search the forum, it's been discussed many, many times.


Thanks for answer!



Yes, 50% of balance i mean with fixed SL and TP. Now my ea is opening one order per trade with for example 0.01 lot if I use if (OrdersTotal()==0), without that it opens trade each tick until conditions are good or it runs out of money.

I will try to search the code in forum, ty.

 
I came out with simple answer.. just tipe in (AccountBalance()*50/100)/takeprofit/10 in ordersend function in the place where is your lot... results is very interesting.. have fun
Reason: