Skip to content

Commit

Permalink
function args
Browse files Browse the repository at this point in the history
  • Loading branch information
micahkendall committed Sep 5, 2024
1 parent 9aae873 commit 7da2b8d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gema.typ
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,9 @@ $f(t) = min {

#algorithm({
import algorithmic: *
Function("CalculateGEMA", args: ("prices", "period"), {
Assign("period", "20")
Function("CalculateGEMA", args: ("prices", "period", "smoothing"), {
Assign("gema", [prices[0]])
Assign("multiplier", $2 / ("period" + 1)$)
Assign("multiplier", $"smoothing" / ("period" + 1)$)
For(cond: "price in prices[1:]", {
If(cond: $"price" < "gema"[-1]$, {
Call("gema.append", "price")
Expand Down

0 comments on commit 7da2b8d

Please sign in to comment.