Skip to content

Instantly share code, notes, and snippets.

@ace3
ace3 / sqn.userscript.js
Last active December 18, 2020 05:47
TamperMonkey
// ==UserScript==
// @name TradingView SQN Calculator
// @namespace https://ignizbot.com/
// @version 0.6
// @description try to take over the world!
// @author Ignasius Wahyudi
// @match https://www.tradingview.com/chart/*/
// @require https://unpkg.com/[email protected]/dist/math.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.30.1/date_fns.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js
class MAcrossover(bt.Strategy):
#Moving Average Parameters
params = (('pfast',20),('pslow',50))
def log(self,txt,dt=None):
dt = dt or self.datas[0].datetime.date(0)
print('%s, %s' % (dt.isoformat(),txt))
def __init__(self):
self.dataclose = self.datas[0].close
# Order variable
self.order = None