Anyone who is familiar with JavaScript (which is quickly becoming the worlds most popular programming language) can build or edit automated trading algorithms — from anywhere.
Write plain JavaScript that executes on the JVM ...
You can even use your favorite JS libraries ...
load('underscore-min.js');
//
/* called on every trade */
//
function calc(symbol, bars, state){
/* get a SMA array with slow period */
var smaSlow = talib.sma(bars, config.properties.smaSlow);
/* get a SMA array with fast period */
var smaFast = talib.sma(bars, config.properties.smaFast);
/* attach them to the Bars as a series */
bars.addSeries('smaSlow', smaSlow);
bars.addSeries('smaFast', smaFast);
/* buy signal */
if (crossAbove(smaSlow, smaFast)) {
/* set state to working to prevent duplicate signals*/
setState(bars, state, WORKING);
/* send a text message */
sns.sendTextMessage('BUY Signal on: ' + symbol);
}
/* sell signal */
if (crossBelow(smaSlow, smaFast)) {
/* set state to working */
setState(bars, state, WORKING);
/* send a text message */
sns.sendTextMessage('BUY Signal on: ' + symbol);
}
}
More Information: [email protected]