MQL4 code required - calculate $value per point
I want to set my TP based on a target % of my account balance. Example:
Balance=$100
Lotsize=0.01
EURUSD
Target % profit = 0.5% of balance
Once I have the $value per point I can then calculate my TP
Your options are:
1: Hire someone
2: Find something in the codebase
3: Find something in the market place
https://www.mql5.com/en/market
4: Learn to code
https://www.mql5.com/en/docs
- www.mql5.com
Your options are:
1: Hire someone
2: Find something in the codebase
3: Find something in the market place
https://www.mql5.com/en/market
4: Learn to code
https://www.mql5.com/en/docs
Ha ha ha ha
Ha ha ha ha
You laugh at my answer? I'm serious. Those are your options.
Do your math.
- 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.
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
Do your math.
- 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.
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
Thanks.
I want to set my TP based on a target % of my account balance. Example:
Balance=$100
Lotsize=0.01
EURUSD
Target % profit = 0.5% of balance
Once I have the $value per point I can then calculate my TP