How to calculate lot based on account currency in Metatrader4

To add comments, please log in or register
viktoriopablo
15
viktoriopablo  

I am a little bit new in this language, but I have the basics.

I want to trade EUR/USD, and my account is in EUR. I have 1000 EUR in my account.

What I want: open a position with stop loss and take profit.

I want to place an order with 100 euro, and I want to set the stop loss to 10 euros, and set the take profit to 5 euros. But as I see the OrderSend method requires lots for placing the order, and levels for stop loss and take profit.

And my problem is: how to calculate these values based on the euro amounts I want to set?

I searched for some lot-pip-etc calculation on the web, but after all what I tried did not work. This is how I wanted to calculate:

double AmountToTradeInEuro = 100;
double AmountToTakeInEuro = 5;
double AmountToMaxLossInEuro = 10;
double Lots = AmountToTradeInEuro / MarketInfo(Symbol(), MODE_TICKVALUE);
double StopLossLevel = AmountToTakeInEuro / MarketInfo(Symbol(), MODE_TICKVALUE);
double TakeProfitLevel = AmountToMaxLossInEuro / MarketInfo(Symbol(), MODE_TICKVALUE);
OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, StopLossLevel, TakeProfitLevel);

Basically I would like to know how to calculate the Lot for 100 euro and how to calculate the Levels for stoploss and takeprofit.

And are the stoploss and takeprofit levels also lots? Or are they different units?

And it is not really clear that what is the stoploss and takeprofit in the OrderSend() method. I know it is called Level, but what is it actually, what do I need to set there? I guess not 5€ and 10€, I think I need to calculate them somehow if I want the result to be 5€ for takeprofit and 10€ for stoploss.

I can't believe that it is so hard to calculate the lot and the other two based on the result I want in euro.

Basic Principles - Trading Operations - MetaTrader 5
Basic Principles - Trading Operations - MetaTrader 5
  • www.metatrader5.com
is an instruction given to a broker to buy or sell a financial instrument. There are two main types of orders: Market and Pending. In addition, there are special Take Profit and Stop Loss levels. is the commercial exchange (buying or selling) of a financial security. Buying is executed at the demand price (Ask), and Sell is performed at the...
William Roeder
20214
William Roeder  

viktoriopablo:

I want to place an order with 100 euro, and I want to set the stop loss to 10 euros, and set the take profit to 5 euros. But as I see the OrderSend method requires lots for placing the order, and levels for stop loss and take profit. And my problem is: how to calculate these values based on the euro amounts I want to set?


And are the stoploss and takeprofit levels also lots? Or are they different units?
  1. Risk depends on your initial stop loss, lot size, and the value of the pair. You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support. Only then can you calculate lot size.
    1. In MT4code:
      1. You place the stop where it needs to be - where the reason for the trade is no longer valid. E.g. trading a support bounce the stop goes below the support.
      2. Account Balance * percent/100 = RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) (Note OOP-OSL includes the SPREAD, and DeltaPerLot is usually around $10/pip but it takes account of the exchange rates of the pair vs. your account currency.)
      3. Do NOT use TickValue by itself - DeltaPerLot and verify that MODE_TICKVALUE is returning a value in your deposit currency, as promised by the documentation, or whether it is returning a value in the instrument's base currency.
                  MODE_TICKVALUE is not reliable on non-fx instruments with many brokers.
      4. You must normalize lots properly and check against min and max.
      5. You must also check FreeMargin to avoid stop out
      Most pairs are worth about $10 per PIP. A $5 risk with a (very small) 5 PIP SL is $5/$10/5=0.1 Lots maximum.
    2. Use a GUI EA like mine (for MT4): Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 6
  2. SL/TP level are prices.
To add comments, please log in or register