Why does leverage affect my robot's performance?

 

Hello!

I started programming a few EAs some days ago, and I've had no problems so far, except for one thing.

I was testing the robots with a 1:500 leverage. When I wanted to try it with lower leverages, I noticed that, the lower the leverage is, the fewer orders the EA opens. In fact, with a 1:10 leverage or lower, the EA opens literally no orders. This happens with all the scripts I've created.

You can take a look, for instance, to this script:

#include <Trade\Trade.mqh>
CTrade trade;

void OnTick(){
   double ask = NormalizeDouble(SymbolInfoDouble(_Symbol, SYMBOL_ASK), _Digits);
   trade.Buy(0.01, NULL, ask, NULL, NULL, "test");
}

In theory, this should open a buy order every tick. And it works with 1:500 leverage, but not with lower ones.


Any ideas about what I could be doing wrong?

Thank you very much! :D

 
Run out of free margin.
 
William Roeder:
Run out of free margin.

Why do I need more margin for lower leverages? Shouldn't it be the other way around? If the leverage is higher, so is the risk I'm taking. If the leverage is lower, the risk is also lower, and thus I'd need less free margin...

 
Ander Aguinaga:

Why do I need more margin for lower leverages? Shouldn't it be the other way around? If the leverage is higher, so is the risk I'm taking. If the leverage is lower, the risk is also lower, and thus I'd need less free margin...

you got it all backwards...

 
Kenneth Parling:

you got it all backwards...

How? I mean, the higher the leverage, the higher the risk..., right? If leverage is higher, you're moving a greater amount of money, so you can also lose a higher amount of money; that's the point of the leverage. As far as I'm concerned! Otherwise, it'd make no sense, for example, that brokers offer higher leverages only for professional traders.


Thank you for your patience. ^-^

 
Ander Aguinaga:

How? I mean, the higher the leverage, the higher the risk..., right? If leverage is higher, you're moving a greater amount of money, so you can also lose a higher amount of money; that's the point of the leverage. As far as I'm concerned! Otherwise, it'd make no sense, for example, that brokers offer higher leverages only for professional traders.


Thank you for your patience. ^-^

If you have an account balance of $1000 and you have leverage of 500:1 you can trade with the equivalent of $500,000

Change the leverage to 50:1 and you can only trade with $50,000

 
  1. Ander Aguinaga: the higher the leverage, the higher the risk..., right?
    No Risk has nothing to do with leverage. Larger leverage and free margin means the broker allows you larger positions.

  2. Risk depends on your initial stop loss, lot size, and the value of the symbol. It does not depend on margin and leverage. No SL means you have infinite risk. Never risk more than a small percentage of your trading funds, certainly less than 2% per trade, 6% total.
    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. AccountBalance * 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 - MQL4 programming forum 2017.10.10
                Is there an universal solution for Tick value? - Currency Pairs - General - MQL5 programming forum 2018.02.11
                Lot value calculation off by a factor of 100 - MQL5 programming forum 2019.07.19
    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 or 0.1 Lots maximum.

 
Ander Aguinaga:

How? I mean, the higher the leverage, the higher the risk..., right? If leverage is higher, you're moving a greater amount of money, so you can also lose a higher amount of money; that's the point of the leverage. As far as I'm concerned! Otherwise, it'd make no sense, for example, that brokers offer higher leverages only for professional traders.


Thank you for your patience. ^-^

It is not about how much risk you allow yourself to take. It is about how much risk the broker allows you to take.

The risk is not related to the leverage. The risk relates to the size of the position. And your maximum position size depends on how much leverage you have, in combination with your account value.

Reason: