This ProBuilder script is designed to calculate and display the overnight fees for both long and short positions based on the last trading bar’s closing price. The fees are calculated considering the broker’s fee and the LIBOR rate.
DEFParam CalculateonLastBars = 1
//PositionSize = 1
//BrokerFee = 2.5
//Libor = 0.4728
LongFee = Round(((PositionSize * close) * (((BrokerFee/100) + (Libor/100))/365))*100)/100
ShortFee = Round(((PositionSize * close) * (((BrokerFee/100) - (Libor/100))/365))*100)/100
DRAWTEXT("Long Fee #LongFee#",BarIndex, 2 ,SansSerif,Bold,16)coloured(153,153,0)
DRAWTEXT("Short Fee #ShortFee#",BarIndex, 1 ,SansSerif,Bold,16)coloured(153,153,0)
return 3,0
This script includes several key components:
This example serves as a practical application of using variables, arithmetic operations, and drawing functions in ProBuilder to create financial indicators.
Check out this related content for more information:
https://www.prorealcode.com/topic/finance-charges/#post-73487
Visit Link