how to calculate swap ?

 

How to calculate swap if lot size is 0.01 for gbpusd

for short/long positions ?


I'm now in short position in gbpusd for 0.01 lot, in Trade tap in Swap section i see $0.09

but if I try to get it by this

printf("swap: buy: %f ,  sell: %f", SymbolInfoDouble(Symbol(), SYMBOL_SWAP_LONG), SymbolInfoDouble(Symbol(), SYMBOL_SWAP_SHORT));

i get the wrong prices

Result: swap: buy: -0.500000 ,  sell: -3.080000

How to get the $0.09 ?

( i would like to know swap for any symbol not for current opened position: double swap = PositionGetDouble(POSITION_SWAP); )

deposit currency usd

thanks

 
It depends of SymbolInfoInteger(symbol,SYMBOL_SWAP_MODE).
 
angevoyageur:
It depends of SymbolInfoInteger(symbol,SYMBOL_SWAP_MODE).

so it returns

SYMBOL_SWAP_MODE_BY_POINTS

buy: -0.500000 ,  sell: -3.080000

how to calculate ?

 
waza123:

so it returns

SYMBOL_SWAP_MODE_BY_POINTS

buy: -0.500000 ,  sell: -3.080000

how to calculate ?

For sell, it's -3.08 points, it's as you have a loosing position of 3.08 points. For GBPUSD and 0.01 lot, that means 0.03008$ for a 1 day swap.

If you have 0.09$ that means 3 days.

 
angevoyageur:

For sell, it's -3.08 points, it's as you have a loosing position of 3.08 points. For GBPUSD and 0.01 lot, that means 0.03008$ for a 1 day swap.

If you have 0.09$ that means 3 days.

why it shows $0.09 if I have only one overnight
 
waza123:
why it shows $0.09 if I have only one overnight
SYMBOL_SWAP_ROLLOVER3DAYS ?
 
angevoyageur:
SYMBOL_SWAP_ROLLOVER3DAYS ?


string WeekdayToString(long day)
  {
   string str="-";
//---
   switch((ENUM_DAY_OF_WEEK)day)
     {
      case SUNDAY    :
         str="Sunday";            break;
      case MONDAY    :
         str="Monday";            break;
      case TUESDAY   :
         str="Tuesday";           break;
      case WEDNESDAY :
         str="Wednesday";         break;
      case THURSDAY  :
         str="Thursday";          break;
      case FRIDAY    :
         str="Friday";            break;
      case SATURDAY  :
         str="Saturday";          break;
     }
//---
   return(str);
  }

string asd = WeekdayToString(SymbolInfoInteger(Symbol(), SYMBOL_SWAP_ROLLOVER3DAYS));


printf("asd %s", asd);

// result: Wednesday


Thank you, problem solved.

 
waza123:


Thank you, problem solved.

Your are welcome.