five bars
shulemmosko opened this issue · 1 comments
shulemmosko commented
Hi, thank you for your work.
I'm about to test Grademark in my login I'm going to need to have access to the last five bars, how do I achieve it?
ashleydavis commented
Set the lookbackPeriod
field of your strategy to 5
and then access the lookback
field of the args
object (it's a Data-Forge dataframe).
Like this:
const strategy = {
lookback: 5,
entryRule: (enterPosition, args) => {
const lookback = args.lookback;
if (have_buy_signal) {
enterPosition();
}
},
exitRule: (exitPosition, args) => {
if (have_sell_signal) {
exitPosition();
}
},
};