- 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
That is for a buy order
SL is open price - SL price
TP is open price + 2*SL
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.
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 Price | 0.76461 |
Lot Size | 0.1 |
DeltaPerLot | About US$ 10 |
Free Margin | US$ 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.
}
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?
Daniel Castro: Does my code is ok with the math behind it?
| No because your code does not match the math I gave. |
- RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot there for lots = currencyRISK / SLrisk / DeltaPerLot
- You code is lots = currencyRisk * DeltaPerLot / SL / 1000
No because your code does not match the math I gave. |
- RISK = OrderLots * (|OrderOpenPrice - OrderStopLoss| * DeltaPerLot there for lots = currencyRISK / SLrisk / DeltaPerLot
- You code is lots = currencyRisk * DeltaPerLot / SL / 1000
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?)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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?