Download MetaTrader 5
To add comments, please log in or register
Track all payments in your profile. It is easy!
Saravanakumar D
357
Saravanakumar D 2016.10.17 19:39 

Hello brothers,

I would like to know how to convert a order commission + swap value into PIP and I need to add that PIP value with Open order value... (So i'll get exact open order price value)


Thanks in Advance.

macpee
287
macpee 2016.10.18 01:56  
I must say that your question requires a little more detail. We would like to know if you want to implement your conversion (or calculation) in an Expert Advisor or you just want to do the calculation yourself and know the value you will get. The first case is a little bit challenging especially if you are new to programing with MQL4 (for MT4 platform). Now the second case - by order commission I believe you mean the spread value for an open position. It is listed on the market watch of your metatrader. As for swap, right click an instrument on the market watch and click 'specification'. You need to convert SWAP and SPREAD (the commision) to POINTS by multiplying each by the POINT value of the instrument you have selected, then add the results you get to your Open order value. Hope this helps.
Saravanakumar D
357
Saravanakumar D 2016.11.08 14:01  
Here you go bro.,,   Kindly forgive me if i post again about this, I'm not a good programmer.,
whroeder1
13644
whroeder1 2016.11.08 14:25  
Saravanakumar D: I would like to know how to convert a order commission + swap value into PIP and I need to add that PIP value with Open order value... (So i'll get exact open order price value)
  1. How does adding anything "with Open order value" give "exact open order price value?" Question makes no sense unless you mean the break even price (include commission & swap.)
  2. Do the 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)
    • Do NOT use TickValue by itself - DeltaPerLot
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
whroeder1
13644
whroeder1 2016.11.08 14:33  
Saravanakumar D: Here you go bro.,,   Kindly forgive me if i post again about this, I'm not a good programmer.,
Your code is only good if the account currency is USD, the symbol is xxxUSD and the size of one lot means DeltaPerLot is exactly $100 USD. That is why it fails for you except for gold.
/
To add comments, please log in or register