Calculating Swap on cross currency.

 

Hello guys


My Terminal shows this pair incurred a short swap of $ -636.00


How would you calculate it in code from the Swap info of this pair, as shown ?


Thank you.



 
SymbolInfoDouble(_Symbol, SYMBOL_SWAP_LONG)
 
Yashar Seyyedin #:

That just gives the short swap value.


How would you calculate it for the position i am taking of 23 lots.


23 * 99 is $2300. But trade says swap charged was $ 636.


Am asking how do I arrive at 636 ?

 
I am not sure in your case. However there is a possibility that swap value changed from yesterday to today. Also note that the values shown on your terminal(or returned by MQL code) could be wrong. Not always brokers provide correct data.
 

To access swap value for a open position:

PositionGetDouble(POSITION_SWAP);

Similarly when it comes to accessing historical deals: 

HistoryDealGetDouble(deal_ticket, DEAL_SWAP);
 
Yashar Seyyedin #:

To access swap value for a open position:

Similarly when it comes to accessing historical deals: 

No. I am trying to calculate swap BEFORE opening the position. I have the position size of 23 lots. How do I know what will be the swap from the pairs swap information I have in symbols screenshot.
 
JForex #:
No. I am trying to calculate swap BEFORE opening the position. I have the position size of 23 lots. How do I know what will be the swap from the pairs swap information I have in symbols screenshot.
You can't really know what the swap will be before opening the position. Most brokers change the swap rate every 24 hours, some brokers add the inventory fees(fees for staying in a position for a long time) to the swap fees, too. Generally the longer you stay in a position, the more swap fees there will be. In terms of calculation from your screenshots, I think you should contact your broker assistant and ask about it because different brokers give different meanings to swap fees. My broker even adds commissions to swap fees You can refer to this discussion I found:https://www.quora.com/Do-you-pay-swap-fees-in-forex-every-time-you-hold-overnight-or-do-you-pay-only-once-and-then-you-can-hold-on-to-it-forever
Do you pay swap fees in forex every time you hold overnight or do you pay only once and then you can hold on to it forever?
Do you pay swap fees in forex every time you hold overnight or do you pay only once and then you can hold on to it forever?
  • www.quora.com
Answer (1 of 3): All Forex exchanges adjust for swap (also referred to as rollover) every 24 hours. In addition, the weekend gap is accounted through a triple swap adjusted almost always on Wednesday’s, which accounts for position’s held on Wednesday, Saturday and Sunday. The position balance on...
 
Cody Outcast #:
You can't really know what the swap will be before opening the position. Most brokers change the swap rate every 24 hours, some brokers add the inventory fees(fees for staying in a position for a long time) to the swap fees, too. Generally the longer you stay in a position, the more swap fees there will be. In terms of calculation from your screenshots, I think you should contact your broker assistant and ask about it because different brokers give different meanings to swap fees. My broker even adds commissions to swap fees You can refer to this discussion I found:https://www.quora.com/Do-you-pay-swap-fees-in-forex-every-time-you-hold-overnight-or-do-you-pay-only-once-and-then-you-can-hold-on-to-it-forever
Nope. I can calculate exact swap for a USD symbol using its lot size and the swap information available on symbol. 

The formula is simple see below. 

For cross currencies it does not work because I am missing the conversion.

Swap = (Pip Value) * (Swap Rate) * (Number of Nights) / 10


 
JForex #:
Nope. I can calculate exact swap for a USD symbol using its lot size and the swap information available on symbol. 

The formula is simple see below. 

For cross currencies it does not work because I am missing the conversion.

Swap = (Pip Value) * (Swap Rate) * (Number of Nights) / 10


The swap rate doesn't change every day for your broker? I was really convinced that you can't calculate that because I once tried to develop a swap arbitrage EA but the calculation was way off in live testing.
 
Cody Outcast #:
The swap rate doesn't change every day for your broker? I was really convinced that you can't calculate that because I once tried to develop a swap arbitrage EA but the calculation was way off in live testing.
You’re misunderstanding. Swap is a daily calculation so rate changes every day. The formula calculates the swap for this day. You simply plug in the daily rate and get swap value for this day. There’s no confusion there.

Quesiron is how do I calculate for a cross currency that does not have USD in it. It’s a matter of conversion that I need help with. Like the pair I show. 
 
JForex #:
how do I calculate for a cross currency that does not have USD in it.
If that's the question, then you could maybe try taking the quotient of two currency USD swaps as new ratio and apply to the same formula. Like  Cross Rate=Currency A to Currency C Rate/Currency A to Currency B Rate