Skip to content

Commit

Permalink
HBS-3908: add bonds yield_<1|30|365>_days
Browse files Browse the repository at this point in the history
  • Loading branch information
arylkou committed Oct 27, 2023
1 parent de0a3a4 commit aa6a607
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions links/bond_yield.pine.link
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,17 @@ float change_percent = na
if not(bond_price[1] < 0) and not(bond_price > 0)
change_percent := change_abs / bond_price[1] * 100
plot(change_percent, title="Bond.Change.%")

day_bond = 1
month_bond = 30
year_bond = 365
day_ago_bond = timenow - 1000 * 60 * 60 * 24 * day_bond
month_ago_bond = timenow - 1000 * 60 * 60 * 24 * month_bond
year_ago_bond = timenow - 1000 * 60 * 60 * 24 * year_bond

countOfBars1DayAgoBond = fastSearchN(time, day_ago_bond, day_bond)
countOfBars1MonthAgoBond = fastSearchN(time, month_ago_bond, month_bond)
countOfBars1YearAgoBond = fastSearchN(time, year_ago_bond, year_bond)
plot(close[countOfBars1DayAgoBond], title="yield_1_days")
plot(close[countOfBars1MonthAgoBond], title="yield_30_days")
plot(close[countOfBars1YearAgoBond], title="yield_365_days")

0 comments on commit aa6a607

Please sign in to comment.