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

 
bryanjald_gmail_com:

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

https://www.mql5.com/en/job

2: Find something in the codebase

https://www.mql5.com/en/code

3: Find something in the market place

https://www.mql5.com/en/market

4: Learn to code
https://www.mql5.com/en/docs

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • www.mql5.com
The EA  is an attempt to maximised TP and Minimised  SL by MA and Bollinger Band MA is used as Trend Identification and BB as exit point for TP and SL Entry is manually, however entry is automated for back testing purpose Further details will be provided, if you agree to take up the job. EA based  solely on volume progression  that  should...
 
Jack Thomas:


Your options are:

1: Hire someone

https://www.mql5.com/en/job

2: Find something in the codebase

https://www.mql5.com/en/code

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

 
bryanjald_gmail_com:

Ha ha ha ha

You laugh at my answer? I'm serious. Those are your options. 

 
bryanjald_gmail_com: Once I have the $value per point I can then calculate my TP

Do your math.

  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.
 
whroeder1:

Do your math.

  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.

Thanks.