MT4 Stop Loss and Take Profit formula

 
Hello all, 

I'd like to know which is the exact formula (used by brokers) to calculate preventively the monetary value of a SL or a TP. 

I'll explain better: if I set a pending order or I send an order to the market and I put mouse over my SL or TP level, the platform says me how much (in deposit currency) I will win or I will lose if the price reach one of those levels. 

I made my personal Position Size Calculator indicator, but I couldn't find the exact formula used by the platform. 

Ty to everyone who will reply

 
Usernamelessss: I'd like to know which is the exact formula (used by brokers) to calculate preventively the monetary value of a SL or a TP. I'll explain better: if I set a pending order or I send an order to the market and I put mouse over my SL or TP level, the platform says me how much (in deposit currency) I will win or I will lose if the price reach one of those levels. I made my personal Position Size Calculator indicator, but I couldn't find the exact formula used by the platform.

This question has been asked so many, many, many times that it has become rather tedious for us to keep explaining it over and over again.

Please do a search here on the Forum and the CodeBase, because you are guaranteed to find the answer repeated several times.

EDIT: Looks like @whroeder1 was generous enough to answer your query without you needing to trouble yourself with searching for it!

 
Usernamelessss: I put mouse over my SL or TP level, the platform says me how much (in deposit currency) I will win or I will lose if the price reach one of those levels.
Risk depends on your initial stop loss, lot size, and the value of the pair.
  • 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
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.
 
Fernando Carreiro:

This question has been asked so many, many, many times that it has become rather tedious for us to keep explaining it over and over again.

Please do a search here on the Forum and the CodeBase, because you are guaranteed to find the answer repeated several times.

EDIT: Looks like @whroeder1 was generous enough to answer your query without you needing to trouble yourself with searching for it!

I searched  many, many, many times this topic and I did many, many, many attempts. But I didn't reached what I was looking for. So I asked here. 


whroeder1:
Risk depends on your initial stop loss, lot size, and the value of the pair.
  • 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
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.

Really thanks for your explanation. I use the same way to calculate orders lots, but now I learned how to normalize lots. And now it seems works fine. 

 
Fernando Carreiro #:

This question has been asked so many, many, many times that it has become rather tedious for us to keep explaining it over and over again.


Yes, this question has been asked so many, many, many times. Why can't so many, many, many people just lose their interest in it already? They are the wrong ones, of course.

No.

When a question is asked so many, many, many times, there is nothing wrong with people, there is something wrong with the software. The calculation is complicated, searching for it helps little because guessing exact wording is very tricky and all kinds of unrelated discussions turn up in the results, and most importantly, the calculation is very error prone. On top of it, the information is there already, the software already has the answer, you can see it if you hover the mouse pointer, but the software won't let us have it otherwise and the forum moderators are tired of answering the question because it's become rather tedious.

It's an omission of the software, an important one, software made by the same people who put buy/sell buttons on the TOP LEFT corner and the only (rather tiny) close button on the BOTTOM RIGHT corner.

But of course we all know that MT4 development is frozen/abandoned, never mind that so many, many, many people still prefer it because MT5 is so much, much, much more complicated and again, error prone because complexity begets errors. So nobody is going to fix the software, and I spent some 15 minutes trying to find that in the MQL5 documentation and it seems MT5 does not provide that information easily either. Well, nothing about MT5 is easy anyway. Because developers have a lot of mind to spend on math and logic but are not interested in the fact that actual human beings will end up using the software.