convert orderswap to pip

 

hi friends

let suppose my tp is 10pips but the order has swap=-2.5
Im using "Orderswap" to show me swap for every orders in journal of Metatrader, and i think it declares in dollar,if im wrong please guide me.
i convert swap by below formula to pip and modify my order by Newtp, after hits tp, it must eliminate the swap effect
double swaptype(double swaps,double lotsize )
  {
   double swappip= 0;
   double tikvalue = MarketInfo(Symbol(),MODE_TICKVALUE);
   double tiksize = MarketInfo(Symbol(),MODE_TICKSIZE);
    double poin = MarketInfo(Symbol(),MODE_POINT);
   
      {
      swappip = floor((swaps *tiksize)/(tikvalue*lotsize*poin))*poin;
     }
   return(swapval);
  }


it seen it not work correctly in all currency pairs

if this is correct for XXXUSD pairs and not other  what changes should to do???

 

I prefer to use points instead of pips because:

1. They are compatible in definition among different trading instruments(symbols/brokers).

2. They are more accurate.

int get_swap_in_point(double swap_in_usd,double lotsize)
  {
      double tikvalue = MarketInfo(Symbol(),MODE_TICKVALUE);
      double tiksize = MarketInfo(Symbol(),MODE_TICKSIZE);
      double point = MarketInfo(Symbol(),MODE_POINT);      
      
      double tick_count = swap_in_usd/(lotsize*tikvalue); 
      int swap_points = (tick_count * tiksize)/point;
      return swap_points;
  }

Note: This is a MT4 thread and should be posted in the correct section.

 
Yashar Seyyedin #:

I prefer to use points instead of pips because:

1. They are compatible in definition among different trading instruments(symbols/brokers).

2. They are more accurate.

Note: This is a MT4 thread and should be posted in the correct section.

whats difference  among  these except point and pip??? you just rewrote my formula here not more!!!!!

my problem is not on point or pips

i want to modify it for all currency pairs alike as (eurusd, gbpusd), crosses (eurjpy, gbpjpy) and for (usdchf, usdjpy)