Overview
Starting from a raw data set, you will likely need to calculate a set of indicators that you will use to calculate trades. Typically, you will just add those indicators onto the price records that you have.
This page discusses methods of coding indicators and appending those values to your price dataset. For a basic introduction to Javascript, please see Javascript Introduction
Scripting Indicators
A standard way to append data onto each record in a dataset is to use the map method.
prices = prices.map((p,i,data)=>{
return {
...p,
indicator://do some calculation here
}
});
The above mapping requires some logic that calculates the indicator in question. This is typically done by coding a function, which takes the prices, the index and the current, and returns the calculated value.
let indicator = function(price, index, data){
//calculate the indicator here
}