Created
June 23, 2020 03:24
-
-
Save tystr/17c857a4859f6129960bb51b60521b28 to your computer and use it in GitHub Desktop.
Tradovate weighted moving average script which allows setting an offset amount
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const predef = require("./tools/predef"); | |
const WMA = require("./tools/WMA"); | |
class weightedMovingAverage { | |
init() { | |
this.wma = WMA(this.props.period); | |
} | |
map(d) { | |
return this.wma(d.value() - this.props.offset); | |
} | |
} | |
module.exports = { | |
name: "wma2", | |
description: "Weighted Moving Average (offset)", | |
calculator: weightedMovingAverage, | |
params: { | |
period: predef.paramSpecs.period(14), | |
offset: { | |
type: "number", | |
def: 2.0, | |
restrictions: { | |
step: 0.25, | |
min: -100.0 | |
} | |
} | |
}, | |
tags: [predef.tags.MovingAverage, "MY Indicators"], | |
schemeStyles: predef.styles.solidLine("#8cecff") | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment