Convert simple Lot Size input into a calculation (Based on Stop Loss and account Balance)

 

Hey! I'm new to MQL.


I have this simple MA Crossover EA (attached in txt) I'm using and I want to have the Lot Size calculated based of % risk (Given Stop Loss in Pips and account balance).

I'm trying to implement the code from https://www.earnforex.com/guides/how-to-calculate-position-size-in-mql4/ but I keep getting undeclared variables and global and local variables mixing.

I'm sure its as simple as naming the variables properly but I cant seem to figure it out. I have experience in coding python but it's not helping with MQL.


Would anyone be able to implement this and show me how it works?

Files:
 
Mher Karadjian: Hey! I'm new to MQL. I have this simple MA Crossover EA (attached in txt) I'm using and I want to have the Lot Size calculated based of % risk (Given Stop Loss in Pips and account balance). I'm trying to implement the code from https://www.earnforex.com/guides/how-to-calculate-position-size-in-mql4/ but I keep getting undeclared variables and global and local variables mixing. I'm sure its as simple as naming the variables properly but I cant seem to figure it out. I have experience in coding python but it's not helping with MQL. Would anyone be able to implement this and show me how it works?
Yes, you will find people willing to do the job for you at the Freelance section of this website.
Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2022.08.13
  • www.mql5.com
The largest freelance service with MQL5 application developers
Reason: