Code mql4

 
Hi, I would need to add a line of code to the "pip value and spread" indicator which allows me to display the size to be used as a lever 1.

Example:

Cross to trade: AUDCAD
Current pip value: € 6.72
Balance Account € 140,000
Lever I want to use: 1

Therefore ....

Position Size: Lots 2.08

The operation is = 140,000 * 1 / 67,200

I only need to leverage 1 because I then multiply or divide myself if I want more or less lever, otherwise the writing screen is filled too much.

In addition, is it possible to display the spread with the separation of decimals? Example, now the EURUSD spread reads it like this: 8 or the GBPJPY spread like this: 18 (because of the 5 decimals) instead I would like EURUSD 0.8 AND GBPJPY 1.8

Thanks1000 !!!!
Files:
 
  1. In code: 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.
    • 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.)
    • 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 (EUR, in this case).
                MODE_TICKVALUE is not reliable on non-fx instruments with many brokers.
    • You must normalize lots properly and check against min and max.
    • 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 EA GUI EA for MT4: Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 5
 
whroeder1:
  1. In code: 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.
    • 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.)
    • 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 (EUR, in this case).
                MODE_TICKVALUE is not reliable on non-fx instruments with many brokers.
    • You must normalize lots properly and check against min and max.
    • 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 EA GUI EA for MT4: Indicators: 'Money Manager Graphic Tool' indicator by 'takycard' Forum - Page 5

I don't understood well... :-( I want only add a string to view the size at lever 1 (account balance*1 (lever) /the sum in Euro es. for eurusd 84.000 about...). In this way I can see the size at lever 1 right?

 
Milko Vivaldi:

I don't understood well... :-( I want only add a string to view the size at lever 1 (account balance*1 (lever) /the sum in Euro es. for eurusd 84.000 about...). In this way I can see the size at lever 1 right?


It's not clear what you hope to accomplish. Are you trying to get the margin requirement for 1 standard lot at 1Leverage?

Reason: