Daily CFD interest AFL code

I would like to obtain AFL code for calculating daily CFD interest applied to open CFD trades. Assume rate is 5% and applied to CFD position size x daily closing price during trade duration. Sat Sun charges = Fri charge.
Thank you.

Your question is too general and isn't detailed enough. See How to ask a good question for details what is needed for person trying to help to understand your problem.

Fair enough and sorry for the vagueness.

CFD holding cost is generally applied by the broker against any position held overnight. It is a fee for borrowing the funds; i.e. leverage.
Holding cost = position size x closing price * daily interest rate / 365. The cost applied on Friday is x 3 to cover Sat & Sun.

The total holding cost for all CFD positions can add up and should be factored in. Any guidance with suitable AFL code would be much appreciated, thanks.

This is a topic and am trying to work out myself as using CFDs in backtesting do not really give a representation of return.
For those that know CFDs you are charged a daily holding rate as wmorton has mentioned earlier. I have looked through what coding you can use in the backtesting side of things with SETOPTION but apart from AccountMargin and FuturesMode, there is nothing about calculating interest on a daily basis.
I have attached the way it is calculated but would like to know how I can incorporate this into a backtest, if its even possible or in not an idea for an improvement into the future releases.
CFD Daily Holding Calculation

First relevant response in 3 1/2 years - thanks for your feedback.
I stuck at this problem and came up with a solution that I am happy with. The holding cost does add up over time especially when the number of open trades increases, so should be included in the backtest results.

Will

You can easily implement this on your own using custom backtester and subtracting required amount from bo.Cash member. Borrowing costs are only subtracted automatically when you trade stocks on margin (i.e. when you actually borrow funds from broker and AccounMargin is set to something else than 100 (no margin)).

Thanks for the reply Tomasz, much appreciated and agreed wmorton, it needs to be included to be realistic when backtesting. The group I trade with mentioned using the Analysis Window General Tab, but I am not 100% sold on that one unless Tomasz knows this works, but by the sounds of his reply the CBT is the way to go. Looks like this is my next learning curve.
Analysis Window

Cheers
Greg