Download MetaTrader 5

initial negative profit

To add comments, please log in or register
Morteza Khorasani
131
Morteza Khorasani  

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 

Keith Watford
Moderator
10536
Keith Watford  
Morteza Khorasani:

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.

Fernando Carreiro
3832
Fernando Carreiro  
Morteza Khorasani: 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.

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

Morteza Khorasani
131
Morteza Khorasani  
Fernando Carreiro:

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:

You mean I have not to consider the commission?
Fernando Carreiro
3832
Fernando Carreiro  
Morteza Khorasani: You mean I have not to consider the commission?

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

Question about Tester Commisions and Swaps
Question about Tester Commisions and Swaps
  • www.mql5.com
Another proof why an EA has most of times completely different results on live...
Keith Watford
Moderator
10536
Keith Watford  
Keith Watford:

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.

Fernando Carreiro
3832
Fernando Carreiro  
Keith Watford:

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)!

To add comments, please log in or register