Page 1 of 1

anyone know mq4 and feel like helping me?

Posted: Fri Jul 17, 2009 6:51 am
by jimmynz
i just need a bit of code added to my ea for money management.

i want to take my available balance x it by a % of my bank and / by the Stop loss.

eg:
Bank $1000 * 2% = $20 (risk)
/ 50 pips SL = .40c per pip (4 micro lots)

(checking the bank prior to a trade)

user inputs= % risk and SL
i trade micro lots.

thanks heaps

Posted: Fri Jul 17, 2009 4:00 pm
by blubbb
You mean the problem that 1 pip rise in EURUSD gives another percentage as 1 pip rise in GBPJPY?

Had this problem in one of my EAs and the calculation of lots would be:

AccountBalance() * Risk / 100 / MarketInfo(Symbol(), MODE_TICKVALUE) / StopLoss

Risk in %
StopLoss in pips

Posted: Sat Jul 18, 2009 12:13 am
by jimmynz
hey good thought. i didn't think of this...
i normally trade the 1 pip = $1 pairs, but should i change to the nonequivalent pairs, id be stooped.

i get all except the "/100" part, could you explain it to me?
also, is there an easy way/place to drop this into my code?

Posted: Sat Jul 18, 2009 12:43 am
by jimmynz
dont worry solved it.
thanks to "smjones"