How to calculate lots in percentage - page 2

 
I didnt know this would be so hard just a way to get $100 to 0.01 in EURUSD what do i divide it with in a way that would work with different leverages without altering it. ok say 10% of my $1000 balance is $100 then get it in units which i guess would be 10,000 which is 0.1 of standard lot right(10000/100000) which we store in a variable "double The_lot=0.1" then we open trade OrderSend(...,...,The_lot,...,...,...). Its ok if the script is for EURUSD only i understand the other currencies would complement things.
 
jameslarry:
I didnt know this would be so hard just a way to get $100 to 0.01 in EURUSD what do i divide it with in a way that would work with different leverages without altering it. ok say 10% of my $1000 balance is $100 then get it in units which i guess would be 10,000 which is 0.1 of standard lot right(10000/100000) which we store in a variable "double The_lot=0.1" then we open trade OrderSend(...,...,The_lot,...,...,...). Its ok if the script is for EURUSD only i understand the other currencies would complement things.

1. Do not guessing with your money.

2. How much is the cost to open 0.1 lot ?. Multiply 0.1 with MarketInfo(Symbol(), MODE_MARGINREQUIRED). How much lot a $100 can buy ?. Divide $100 with MarketInfo(Symbol(), MODE_MARGINREQUIRED).

3. Always calculate the stop loss, because this is the loss of your money.

Why don't you test it with other currencies as well. It's all the same.

 
Please check my new updates here https://www.mql5.com/en/forum/140051
 
onewithzachy:

The reason I said that, was because I did not calculate any Swaps, AccountStopoutLevel (), AccountStopoutMode(), because that will involve more calculation.

Here, this is an example on how to calculate the price 1 lot of EURUSD. For example the current price EURUSD is 1.23456, leverage is 500, so the price of 1 standard lot of EURUSD is (1.23456 * 100.000)/500 which is the same with MarketInfo(Symbol(), MODE_MARGINREQUIRED).

Just open 1 lot of EURUSD and see it your self.

Hi, when you say tha leverage is 500 you mean leverage 1:500 ?

 
heelflip43 #:

How you trade is entirely up to you, if your comfortable with 10% being open then trade with 10%. Personally I would go for the $100 maximum loss rather than $100 margin but the one you want is the first one: amount/MarketInfo(Symbol(), MODE_MARGININIT). And you would want to use AccountBalance()

Try that.

why use OP_BUY? Does it mean it won't calculate the shorts positions?
 
onewithzachy #:

Compiled, not tested not checked, take your own risk, use wisely.

Hello 
How can I install this, please help me
Thank you