I am kind of new here and I need kind of an advice from you. For me this is kind of a more complex problem.

I would like to make an algorithm based on macd indicator and signal line. Lets say I will trade EURUSD.

The strategy would be that if the macd crosses signal line from beneath I predict that EUR would get stronger against USD and so I buy EUR and the when I make lets say 0.5% I will sell it. On the other hand when macd crosses signal line from above I predict that USD is going to be stronger against EUR and so I will buy USD as it is going to get stronger and then again sell it with some profit.

Of course this is only the idea, but I somehow can not imply the buying thing for both. Because for stocks it is just buying and selling but in forex, you can buy either USD or EUR and then sell them.

Sorry if the explanation is not straight forward, I apologise and I would be really glad if you would give me some idea or post a bit of code that would solve this problem.

Thank you