Brokers overnight interest rate
Forums › ProRealTime English forum › ProOrder support › Brokers overnight interest rate
- This topic has 14 replies, 1 voice, and was last updated 4 months ago by SweTrade.
-
-
12/29/2016 at 7:31 PM #19374
Hi. Is there anyway to code or take in consideration the Brokers overnight interest rate in ProOrder?
I can see there is an estimated brokers fee, but that does not add overnight interests, only add a one time fee. Since IG actually charge what more or less would be 0.8 euro a night/position on DAX 1e mini, it kind of adds up. for example if you have 2 position open a week you will be charged around 11 euros of interests+ spread. that’s quite a lot,so it would be nice to have the possibility to code this with your strategy.
Cheers Kasper
12/29/2016 at 8:50 PM #1938812/30/2016 at 8:55 AM #19399So if you have overnight forex positions on a wednesday they charge you for 3 days?
12/30/2016 at 10:42 AM #19402There is a possibility to compute the interest rate. But you will not be able to have all the benefit of the Probacktest window result. You could make a new variable, graphed on chart with STRATEGYPROFIT minus the interest rate previously calculated. This is the first idea that come to mind 🙂
12/30/2016 at 11:51 AM #19412Hi Nicolas, and thanks for the idea, I will try and come up with something 🙂
12/30/2016 at 12:29 PM #19420could this be true?
on a 4H chart- given is 0.8 euro interest per Position per night on DAX 1euro mini.
it just took out 21% of pathfinder profit 🙁
123456789101112FourHoursChart=5once countofdays=0if not onmarket thencountofdays=0elsif onmarket and Intradaybarindex =FourHoursChart thencountofdays=countofdays+1elsecountofdays=countofdaysendifgraph strategyprofit-(countofdays*0.8*countofposition) COLOURED(0,0,255) AS "IGprofit"graph countofdays COLOURED(0,0,0) AS "countofdays"01/01/2017 at 7:32 PM #19582There is a problem with this code. I will return when I solved the issue
01/01/2017 at 7:51 PM #19583I think this is more correct. also it did not take 21% profit as first assumed. I can see around 6% of Pathfinder V6.0 DAX 4H. I Have added a screendump for verification.
Please comment on this.
12345678910111213141516ONCE BrokerProfit=0FourHoursChart=5once countofdays=0if not onmarket thencountofdays=0elsif onmarket and Intradaybarindex =FourHoursChart thencountofdays=countofdays+1BrokerProfit=BrokerProfit+countofdays*0.8*countofpositionelsecountofdays=countofdaysBrokerProfit=BrokerProfitendiftrueEquity=Equity-BrokerProfitgraph BrokerProfit COLOURED(255,0,0) AS "BrokerProfit"graph trueEquity COLOURED(0,0,255) AS "trueEquity"graph countofdays COLOURED(0,0,0) AS "countofdays"01/01/2017 at 9:29 PM #1959401/01/2017 at 10:15 PM #19595Ahh of cause. And yes. 6% is nothing I agree on that:-)
I forgot the rest of the code. here it is
123456789101112131415161718Capital = 10000equity = Capital + StrategyProfitONCE BrokerProfit=0FourHoursChart=5once countofdays=0if not onmarket thencountofdays=0elsif onmarket and Intradaybarindex =FourHoursChart thencountofdays=countofdays+1BrokerProfit=BrokerProfit+countofdays*0.8*countofpositionelsecountofdays=countofdaysBrokerProfit=BrokerProfitendiftrueEquity=Equity-BrokerProfitgraph BrokerProfit COLOURED(255,0,0) AS "BrokerProfit"graph trueEquity COLOURED(0,0,255) AS "trueEquity"graph countofdays COLOURED(0,0,0) AS "countofdays"01/02/2017 at 10:01 AM #19600Thanks Kasper for this code snippet, fees are a major thing we too much often ignore and that can broke up a nice equity curve.
I’ll put this code into the blog for future references.
1 user thanked author for this post.
01/04/2017 at 8:32 AM #19773Hi Nicolas, yes that is a great idea to put it in the Blog section. I would have taken the task off your busy hands but I couldn’t create a blog. Perhaps it meant to be like this?
Cheers Kasper
1 user thanked author for this post.
01/04/2017 at 4:09 PM #19833Congratulations about your first blog post: https://www.prorealcode.com/blog/learning/overnight-fees-calculation-proorder-strategies/
Any other ideas are welcome, everyone can be published in the blog section of the website 🙂
1 user thanked author for this post.
01/19/2017 at 11:31 AM #2166506/10/2024 at 1:30 PM #233679I just did a little update to this code to make it work with all timeframes. I also added the 3x overnight fees on the weekend, that the previous code didnt have. Let me know if you see any issues with it, but it seem to work correct for me. I’m a noob at coding so there might be some issues! You need to update the time where overnight fee take action in your timezone. You also need to adjust posSize to your sizing.
brokers-overnight-interest-rate12345678910111213141516171819202122232425262728293031323334353637383940// --- Parameters ---Capital = 10000 // Initial capital of the accountovernightfee = 3.5 // Broker overnight fee per conract per day in money. 3.5 EURO 20240610 in Sweden with IG.posSize = 1OnlyCountWeekends = 0 // 0 = Count all overNightFees, 1 = Only Count Weekend OvernightFees// --- Define Trading Day End ---endOfDayTime = 230000// --- Equity and Broker Profit Calculation ---equity = Capital + StrategyProfitONCE BrokerProfit = 0ONCE totalOvernights = 0ONCE countOfDays = 0if not onmarket thencountOfDays = 0elsif onmarket and time >= endOfDayTime then// Increment countOfDays only if this is the first time during the dayif OnlyCountWeekends = 0 and time = endOfDayTime and currentDayOfWeek <> 5 thencountOfDays = countOfDays + 1totalOvernights = totalOvernights + 1elsif time = endOfDayTime and currentDayOfWeek = 5 thencountOfDays = countOfDays + 3totalOvernights = totalOvernights + 3endifendifBrokerProfit = totalOvernights * overnightfee * posSizetrueEquity = Capital + StrategyProfit - BrokerProfit// --- Graph Plotting ---graph BrokerProfit coloured(255,0,0) as "Broker Profit"graph trueEquity coloured(0,0,255) as "True Equity"graph totalOvernights coloured(0,0,0) as "Total Overnights"How do I use this code snippet? I compare the trueEquity number, with the strategy profit if I add an exit at 224500, to avoid overnight fees (either all overnight fees or only close positions before the weekend). For example:
time exit1234567//Time Exit//If currentDayOfWeek = 5 and time=224500 then //or use next rowIf time=224500 thensell at marketexitshort at marketendifMaybe this helps someone! Please let me know if you find any issues or have any improvements to the code.
-
AuthorPosts
Find exclusive trading pro-tools on