How to calculate pips distance from volume and profit.

 

Dear,

I want to create a function to return pips value base on my volume and profit in currency.

I already create a function but not working.

int PointFromAmount(double LotSize2, double RecoveryLoss)
{
    double UnitCost = MarketInfo(Symbol(), MODE_TICKVALUE);
    double TickSize = MarketInfo(Symbol(), MODE_TICKSIZE);
    double PerValue = (UnitCost)*(LotSize2);
    return((int)MathRound(PerValue*RecoveryLoss));
}


Here LotsSize like i will put = 0.32

and RecoveryLoss like i will put   = 50$

So function return points distance need to profit 50$ with 0.32 lots.

Please someone help me to complete this function.

 
    • 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
    • You must normalize lots properly and check against min and max.
    • You must also check FreeMargin to avoid stop out
    Do the algebra and solve for the change in price. You have your lots, and profit (RISK.) DeltaPerLot includes ticksize. Your code does not.
  1. web11: I want to create a function to return pips value base on my volume and profit in currency.
    Then you need to make up your mind. Do you want to return pips, (as you say?) Do you want to return points, (as your function name suggests.) Or do you want to return a change in price, (which is what you are trying to calculate?)
 
whroeder1:
  1. Do the algebra and solve for the change in price. You have your lots, and profit (RISK.) DeltaPerLot includes ticksize. Your code does not.
  2. Then you need to make up your mind. Do you want to return pips, (as you say?) Do you want to return points, (as your function name suggests.) Or do you want to return a change in price, (which is what you are trying to calculate?)



I want return Points of Distance amount of loss or profit with selected lots size?

 
web11: I want return Points of Distance amount of loss or profit with selected lots size?
There is no such thing as "Points of Distance." You can return
Distance (non-JPY)
 Points Pips
0.01234
1234
123.4
Reason: