True Leverage

 
I there a function to calculate true levearge?

I need to do it Dividing position size in USD  in Equity.



Bests

 
magonicolas: I need to do it Dividing position size in USD  in Equity.
You have defined it. So write your function. You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum

 
magonicolas:
I there a function to calculate true levearge?

I need to do it Dividing position size in USD  in Equity.



Bests

There is no function, it needs to be coded.

This name of "true leverage" is really a bad one, it's confusing and misleading, it's supposed to be "true" but it's not a leverage at all. Leverage is related to margin and only to margin. You should rather use the name and concept of exposure.

 
Alain Verleyen:

There is no function, it needs to be coded.

This name of "true leverage" is really a bad one, it's confusing and misleading, it's supposed to be "true" but it's not a leverage at all. Leverage is related to margin and only to margin. You should rather use the name and concept of exposure.

Ok, maybe is not the best name.


I just don't know how to code the amount of USD of Opened positions.

 
William Roeder:
You have defined it. So write your function. You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your problem.
          No free help

Or pay someone. Top of every page is the link Freelance.
          Hiring to write script - General - MQL5 programming forum

I haven't started coding it yet, Since I don't know how to do it.


I just don't know how to code the amount of USD of Opened positions.


Bests

 
magonicolas:

Ok, maybe is not the best name.


I just don't know how to code the amount of USD of Opened positions.

You loop between all your positions, the for each one you convert it to USD by applying the appropriate rate, and you add all.

Example of a 0.1 EURUSD position, that's 10,000 EUR converted at 1.13058 (multiplied by EURUSD rate) to 11,305.8 USD.

Example of a 0.25 CADCHF position, that's 25,000 CAD converted at 1.34234 (divided by USDCAD rate) to 18,624.19 USD.

Total 29930 USD (rounded).

 
Alain Verleyen:

You loop between all your positions, the for each one you convert it to USD by applying the appropriate rate, and you add all.

Example of a 0.1 EURUSD position, that's 10,000 EUR converted at 1.13058 (multiplied by EURUSD rate) to 11,305.8 USD.

Example of a 0.25 CADCHF position, that's 25,000 CAD converted at 1.34234 (divided by USDCAD rate) to 18,624.19 USD.

Total 29930 USD (rounded).

Thanks, I actually know the logic on how to do it, I don't have that much experience and knowledge  on MQL to do it in this specific language. Any snippet of code on how to do it would help me.


Bests

Reason: