Hello
I want to know how to calculate the initial negative profit immediately after opening a position.
Is it just a function of spread and lotsize? Or there are something else that must be considered//?
Please tell me the formula for calculating this.
thanks
Find the spread in ticks and multiply by Tickvalue.
You will also need to include any commissions, but I am not aware of a way to do his except getting a value from a previous trade.
Is it just a function of spread and lotsize? Or there are something else that must be considered//?
Please tell me the formula for calculating this.
Yes, only the opening spread and the order volume (lots) defines the initial opening loss. Even if there is slippage, it is still based on the opening spread.
You can calculate it the the same way you calculate anything else pertaining to an order, be it the StopLoss, TakeProfit, TrailingStop, etc.
Here is a quote form another user:
whroeder1:
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't use it. It's use is always wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
- 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
Yes, only the opening spread and the order volume (lots) defines the initial opening loss. Even if there is slippage, it is still based on the opening spread.
You can calculate it the the same way you calculate anything else pertaining to an order, be it the StopLoss, TakeProfit, TrailingStop, etc.
Here is a quote form another user:
The commission is irrespective of the initial spread loss. It does not matter if the order closes in profit or in loss, commission is always charged.
If however, you also want to factor in the commission, then just read it off with the OrderCommision() function. Also read the following post of mine: https://www.mql5.com/en/forum/166621#comment_3995363
- www.mql5.com
Find the spread in ticks and multiply by Tickvalue.
You will also need to include any commissions, but I am not aware of a way to do his except getting a value from a previous trade.
I may have misunderstood the OP's question.
Do you want to calculate what the initial loss will be before opening an order or do you want to find out what it is immediately after opening an order?
If after, then you can use OrderCommision()+OrderProfit() after selecting the order.
I may have misunderstood the OP's question.
Do you want to calculate what the initial loss will be before opening an order or do you want to find out what it is immediately after opening an order?
If after, then you can use OrderCommision()+OrderProfit() after selecting the order.
Good point! I was assuming it was before placing the order (which is why I linked the post about calculating commission), but maybe the OP does just want to know it afterwards, making the solution much simpler!
EDIT: After reading his post again, he does say "after opening a position"! Thanks Keith, for noticing it!
We "techies" do tend to complicate things and not see the obvious sometimes (referring to myself and this "daaah!" moment)!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I want to know how to calculate the initial negative profit immediately after opening a position.
Is it just a function of spread and lotsize? Or there are something else that must be considered//?
Please tell me the formula for calculating this.
thanks