swap value in pip for every kind swaptype

 
Hello geniuses
I have faced a problem with the swap
I want the amount of net profit for each order to be constanted

It means to apply the amount of swab in pip toTP

for every order i use OrderSwap() to get its swap then

if swaptype = 0 it mean OrderSwap() is in point, then it needs to  convert to pip ans apply to TP

if swaptype = 1 it mean OrderSwap() is in the symbol base currency , then swap in points=(swap in USD)/(tickvalue*lot) FOR EXAMPLE USD  base currency

is it right or wrong way?????

and for

if swaptype = 2

if swaptype = 3 

how i can have  OrderSwap() in point?

please guide me if you know it

thank you for غour attention Sincerely and humbly

 

Looks like value returned by brokers for swap type is not reliable. Therefor it is better to check for every single broker manually before deciding which type.

 
Yashar Seyyedin #:

Looks like value returned by brokers for swap type is not reliable. Therefor it is better to check for every single broker manually before deciding which type.

Its apart of a robot and it gets information from broker, we can't check manually 
 
Please if someone konw anything's about it, guide me, I'm searching a way yet
🙏🙏🙏🙏🙏
 

Generally I never needed to do so because I always used one trade(or set of trades to be closed at the same time) at a time and the profit in that case can be easily estimated with:

expected_profit=AccountEquity()-AccountBalance();
So I never needed to set a fixed TP limit. All I needed was to monitor the unrealized profit and close using OrderClose().
 
Yashar Seyyedin #:

Generally I never needed to do so because I always used one trade(or set of trades to be closed at the same time) at a time and the profit in that case can be easily estimated with:

So I never needed to set a fixed TP limit. All I needed was to monitor the unrealized profit and close using OrderClose().

I set Tp for some trades to close them together  too

But for set Tp, it applies swap in calculations 

Its why we need to swap to pip

 
st.khalili #:

I set Tp for some trades to close them together  too

But for set Tp, it applies swap in calculations 

Its why we need to swap to pip

Unrealized profit that you see in your terminal window counts for everything(commission, swap and etc)

This file contains a few functions and could give you a hint how to get the cost when you are in exotic modes of swap_type.

Files: