Buy stocks worth fixed amount of money
-
Hi everyone,
I'm programming a simple EA that opens long or short positions (stocks CFDs) following a signal from an indicator. The EA shall be connected to different symbols in MT5. For example, I will have an EA on an Apple chart and an EA on a Facebook chart. Let's assume an initial account balance of 100.000€. I'd like the Apple EA to buy 5.000€ worth of stock. At a stock price of 150€ the EA would buy 33 stocks. Then the Facebook EA receives a buy signal and it also buys stocks worth 5.000€ - in this case it buys 25 stocks.
After 20 such trades my balance will be zero and the EA stops buying since there's no more money in the account. It will continue to buy only after some positions have been closed and the balance is >0.My question: Is there a way in fxDreema to make this work. I couldn't find this under money management. I tried "Risk fixed amount of money" but didn't get anywhere.
Any help is much appreciated!
Thanks
Adrian -
you would have to think in terms of balance % and divide by the # of stocks you anticipate trading in.
-
Hey @TipsyWisdom , thanks for the input. The problem with % of balance as I see it: The actual amount that is used for buying shares gets smaller and smaller after each trade since the balance as a whole gets smaller. My goal is to always buy for the same fixed amount of money. It seems so easy and obvious but I wouldn't know where to look within MT...