Download MetaTrader 5

Calculating Take Profit to get the double of the trade

To add comments, please log in or register
Daniel Castro
80
Daniel Castro  

I am trying to find something similar here in the forum but so far found nothing.

My problem is to calculate a Take Profit that allow me to get what I traded so, if I risk US$ 100,00 (converted to the LOT SIZE and taking care of the Margin) on a trade I would like to get the US$ 200,00 in return.

I am still confused about how to do it.

I understand that my lot size is LOTSIZE = NormalizeDouble(AccountFreeMargin() * ((Risk /100) / 1000.0), LotDigits); 

Where Risk is the Risk I am willing to take and LotDigits is the number of decimal digits allowed for a lot.

But what is the pip value calculation to be executed and estimate the Take Profit to double the return? 

whroeder1
16058
whroeder1  
Daniel Castro: I understand that my lot size is LOTSIZE = NormalizeDouble(AccountFreeMargin() * ((Risk /100) / 1000.0), LotDigits);
No it is not. Do you think a 10 pip SL and a 10000 pip SL have the same risk per lot?
  • 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
Keith Watford
Moderator
10619
Keith Watford  
Set your TP at double the SL

That is for a buy order

SL is open price  - SL price

TP is open price + 2*SL
Irwan Adnan
928
Irwan Adnan  
Daniel Castro:

I am trying to find something similar here in the forum but so far found nothing.

My problem is to calculate a Take Profit that allow me to get what I traded so, if I risk US$ 100,00 (converted to the LOT SIZE and taking care of the Margin) on a trade I would like to get the US$ 200,00 in return.

I am still confused about how to do it.

I understand that my lot size is LOTSIZE = NormalizeDouble(AccountFreeMargin() * ((Risk /100) / 1000.0), LotDigits); 

Where Risk is the Risk I am willing to take and LotDigits is the number of decimal digits allowed for a lot.

But what is the pip value calculation to be executed and estimate the Take Profit to double the return? 

Perhaps you need to include a tick value in your calculation.

MarketInfo(_Symbol,MODE_TICKVALUE);
Daniel Castro
80
Daniel Castro  
whroeder1:
No it is not. Do you think a 10 pip SL and a 10000 pip SL have the same risk per lot?

Sorry if I do not follow what you are trying to teach me.

In my understanding a TP 2 times the Stop Loss defines only a Risk / Return strategy. 

Account Balance * percent/100 = RISK = OrderLots.  I agree. 

OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot + CommissionPerLot) - Would it be the amount in currency that I accept to loose on a Trade?

Assuming it is as I understood, the Take Profit that doubles my return would be...


 

[(OrderTakeProfit - OrderOpenPrice)  * DeltaPerLot + CommisionPerLot] = 2 x OrderOpenPrice + CommisionPerLot

 (OrderTakeProfit - OrderOpenPrice)  * DeltaPerLot =  2 x OrderOpenPrice

 OrderTakeProfit = 2 x OrderOpenPrice / DeltaPerLot + OrderOpenPrice

Is that it? 

I think there is something wrong with that because the Order has unit of money and DeltaPerLot is Money/Scalar, which is money, and again a Money unit.

The TakeProfit must come in PIPS so my Guess is that  there is something missing.

Lets make an exercise with AUDUSD

AUDUSD
Open Price0.76461
Lot Size0.1
DeltaPerLotAbout US$ 10
Free MarginUS$ 12.000

So, what would be my calculation?

 

//Assuming the data present on the table above.
double
TakeProfitToDouble(double OpenPrice, double Risk){
        double MONEY_AT_RISK = NormalizeDouble(AccountFreeMargin() * (Risk /100),2);
        //MONEY_AT_RISK = 12.000 * 0.01 = 120
        //Convert risk per trade from your LOCAL currency terms to the currency you are TRADING
        MONEY_AT_RISK *= PointValuePerLot(); //Is that it? Here I have a doubt.
        //MONEY_AT_RISK will be then 120/0.76461 = US$ 156.94
        //Determine the number of pips to your stop loss from your entry price.  I would like a SL of 50 pips
        int SL = 50;
        double RISK_PER_PIP = MONEY_AT_RISK / SL;
        //RISK_PER_PIP = US$ 3.14 ( US$ 156.94 / 50)
        //Figure out the smallest tick value for the currency you are trading.
        //CALCULATING LOT SIZE
        double RETURNED_LOTSIZE = NormalizeDouble((MONEY_AT_RISK / 1000.0), 2);
        //RETURNED_LOTSIZE = 0.157 = US$ 156.94 / 1000
        //LOT = 100.000 units = US$ 10
        //MINI LOT = 0,1 LOT - 10.000 units = US$ 1
        //MICRO-LOT = 0.01 LOT - 1.000 units = US$ 0.1
        //NANO LOT = 0.001 LOT = 100 units = US$ 0.01

        //Risking US$ 3.14 per PIP (RISK_PER_PIP), if the trend moves in my favor

        //BUYING 0.157 * STANDARD LOT -> 1 PIP IN MY FAVOR = 10 * 0.157  = US$ 1.57 PER PIP IN MY FAVOR
        //TO DOUBLE THE ENTRY VALUE OF MONEY_AT_RISK I MUST
        //156.94 * 2 = 313.88
        //1 PIP = 1.57 SO I will need 314 Pips (Rounded Up) / US$ 1.57 PIPS in my favor, that is 200 PIPS
        double TP = 2 * (MONEY_AT_RISK)/(RETURNED_LOTSIZE * 10);
        return TP;
}

double  PointValuePerLot(string pair="") {

    if (pair == "") pair = Symbol();

    return(  MarketInfo(pair, MODE_TICKVALUE)

           / MarketInfo(pair, MODE_TICKSIZE) ); // Not Point.

 

Irwan Adnan
928
Irwan Adnan  
One pips (10 points int 5 digits) is equivalent to tick value as deposit currency. So if tick value = 0.95 for euro as deposit currency then 1 pip is equal to 0.95 euro in EUR/USD pair.
whroeder1
16058
whroeder1  
  1. It's 9.5 euros per lot only because the account currency is the base pair.
  2. Compute general case #1
Daniel Castro
80
Daniel Castro  

Thanks for the contribution but I still not follow.  What are you trying to say?

Does my code is ok with the math behind it? 

whroeder1
16058
whroeder1  
Daniel Castro: Does my code is ok with the math behind it? 
No because your code does not match the math I gave.
  1. RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot there for lots = currencyRISK / SLrisk / DeltaPerLot
  2. You code is lots = currencyRisk * DeltaPerLot / SL / 1000
Daniel Castro
80
Daniel Castro  
whroeder1:
No because your code does not match the math I gave.
  1. RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot there for lots = currencyRISK / SLrisk / DeltaPerLot
  2. You code is lots = currencyRisk * DeltaPerLot / SL / 1000
I will adjust it.  Thank you.

I am still confused with a definition here.

As you state, RISK is associated with Stop Loss.
If you have a huge tolerance my order could have a large gap going from Order Open Price to Stop Loss.  As large as it is this gap the chances of that the order closes by Stop loss gets smaller.  And the modulus works fine for BUY or SELL.

Going to a different way of thought: A risk can be represented as a percentage of your equity, or available margin, that you are willing to bet (not a blind bet but based on objectives criteria that increases your odds) expecting a trade win, making profits.  Following that interpretation (just reinforcing I understood your explanation and I am purposing another way of thinking about this subject) the Stop Loss is irrelevant to the risk, acting as just a limit of your admissible losses of your bet and the Take Profit is the desired profit that configures an exit point where those profits are materialized.  This is the interpretation that makes more sense to me.  Again I am not saying I am right or you are right but in order to develop anything we must understand the concepts behind and this is what I am trying to do.

I apologize if I do not fully understand the way you explained your line of thought.
whroeder1
16058
whroeder1  
Risk is associated with the SL. The larger the SL, the larger the risk per lot. Therefor if you want the same risk, you must reduce the lot size.

Margin is irrelevant in computing your risk; it is the brokers SL. When free margin goes to zero, the broker exits your loosing trade. In my original post (#1 last line) I pointed how to reduce your lot size even more to avoid margin call (stop out.) Who do you think has the larger risk, you or your brokers margin call (50% of your account?)
To add comments, please log in or register