Boll Fool Version
JavaScript strategy by sabar.
The original spec has no written description. Read the source below.
Source JavaScript
function main (){
$.CTA("BTC_USDT", function(st){
var r = st.records; //ObtainKLine array
if (r.Length <20) return; // FilterKLine length
var close = r[r.length - 2].close; //Get the upper rootKLine closing price
var mp = st. positLon.amount; //Get Position Information
var boll = TA.BOLL(r, 20, 2); // Calculate Bollinger Bands indicator
var upLine = boll[0];
//Get Upper Band Array
var midLine = boll[1]; //Get Middle Band Array
var downLine = boll[2];//Get Lower Band Array
var upPrice = upLine [upLine.length -2];
//Get the upper rootKLine's Upper Band Array
var midPrice = midLine[midLine.length -2];
//Get the upper rootKLine's Middle Band Array
var downPrice = downLine[ downLine.length -2];
//Get the upper rootKLine's Lower Band Array
if(mp == 1 && (close < midPrice)) return -1; //If holding a long position and the closing price is below the middle band, close long
if (mp == -1 && (close > midPrice)) return 1; //If holding a short position and the closing price is above the middle line, close the short.
if (mp == 0 && close > midPrice) return 1; //If there is no position and the closing price is above the upper band, go long
if (mp == 0 && close < midPrice) return -1; //If there is no position, and the closing price is below the lower band, open a short position
});
} Published by sabar on the FMZ strategy square · last modified 2021-09-23. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Boll-Fool-Version.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Test Bollinger Bands Strategy Is Based on the Strategy FrameworkJavaScript · Other
- Bull Bear and Monkey Market Judgment V10 District LeaderJavaScript · Other · 1d
- Bryn Martin Beta V14MyLanguage · Other
- QQE MOD SSL Hybrid Waddah Attar ExplosionPine Script · Other · 4h
- SuperJump Turn Back Bollinger BandPine Script · Other · 30m
- AK MACD BB INDICATOR V 100Pine Script · Other · 45m