Skip to content

Instantly share code, notes, and snippets.

View iCodeForBananas's full-sized avatar

Michael Calkins iCodeForBananas

  • AWS
  • Seattle, WA
View GitHub Profile
@iCodeForBananas
iCodeForBananas / bb.pine
Created November 25, 2023 18:35
Bollinger Mean Reversion [iCodeForBananas]
//@version=5
strategy("Bollinger Mean Reversion [iCodeForBananas]", overlay=true, initial_capital = 5000, default_qty_value = 10, pyramiding = 30, default_qty_type= strategy.percent_of_equity, slippage=1, process_orders_on_close=true)
bbLength = input(45, 'MA length', group = 'Entry')
stdLength = input.float(2, 'Std dev', group = 'Entry')
trailStopMALength = input(80, 'Trail stop EMA length', group = 'Exit')
trailStopMA = ta.ema(close, trailStopMALength)
[middle, upper, lower] = ta.bb(close, bbLength, stdLength)
@iCodeForBananas
iCodeForBananas / pricecross.pine
Created November 21, 2023 15:04
Price Cross MA [iCodeForBananas]
//@version=5
strategy("Price Cross MA [iCodeForBananas]", overlay=true, initial_capital = 5000, default_qty_value = 10, pyramiding = 0, default_qty_type= strategy.percent_of_equity, slippage=1, process_orders_on_close=true)
entryMALength = input(50, 'Trade entry EMA length', group = 'Entry')
trailStopMALength = input(150, 'Trail stop EMA length', group = 'Exit')
trailStopQtyPercent = input(100, 'Stop quantity %', group = 'Exit')
entryMA = ta.ema(close, entryMALength)
trailStopMA = ta.ema(close, trailStopMALength)
@iCodeForBananas
iCodeForBananas / brokenhighs.pine
Created November 21, 2023 15:04
Broken High/Low Strategy [iCodeForBananas]
//@version=5
strategy("Broken High/Low Strategy [iCodeForBananas]", overlay=true, initial_capital = 5000, default_qty_value = 10, pyramiding = 0, default_qty_type= strategy.percent_of_equity, slippage=1, process_orders_on_close=true)
trailStopMALength = input(200, 'Trail stop EMA length', group = 'Exit')
trailStopQtyPercent = input(100, 'Stop quantity %', group = 'Exit')
trailStopMA = ta.ema(close, trailStopMALength)
isGreenCandle = close > open
isRedCandle = close < open
@iCodeForBananas
iCodeForBananas / macd.pine
Created November 21, 2023 15:03
MACD w/ Stop EMA [iCodeForBananas]
//@version=5
strategy("MACD w/ Stop EMA [iCodeForBananas]", overlay=true, initial_capital = 5000, default_qty_value = 10, pyramiding = 0, default_qty_type= strategy.percent_of_equity, slippage=1, process_orders_on_close=true)
fastlen = input(4, 'Fast length', group = 'Entry')
slowlen = input(10, 'Slow length', group = 'Entry')
siglen = input(4, 'Signal length', group = 'Entry')
trailStopMALength = input(200, 'Trail stop EMA length', group = 'Exit')
trailStopQtyPercent = input(100, 'Stop quantity %', group = 'Exit')
@iCodeForBananas
iCodeForBananas / gist:7d363db2403ab1154ca0034e6aadceed
Created November 14, 2023 14:56
Broken High/Low Strategy [iCodeForBananas]
//@version=5
strategy("Broken High/Low Strategy [iCodeForBananas]", overlay=true, initial_capital = 5000, default_qty_value = 25, pyramiding = 10, default_qty_type= strategy.percent_of_equity)
useEMAForStop = input.bool(false, 'Use trail stop EMA', group = 'Exit strategy')
trailStopMALength = input(8, 'Trail stop EMA length', group = 'Exit strategy')
fastMALength = input(5 , 'Fast MA length', group = 'Trend strength')
fastEMAEnabled = input.bool(false, 'Fast EMA enabled (default is SMA)', group = 'Trend strength')
slowMALength = input(10, 'Slow MA length', group = 'Trend strength')
@iCodeForBananas
iCodeForBananas / brokenHighsLows.pine
Created November 6, 2023 20:03
Broken highs/lows in trend
//@version=5
strategy("New Strategy", overlay=true, initial_capital = 5000, default_qty_value = 25, pyramiding = 4, default_qty_type= strategy.percent_of_equity)
FromMonth=input.int(defval=1,title="FromMonth",minval=1,maxval=12, group = 'Time filters')
FromDay=input.int(defval=1,title="FromDay",minval=1,maxval=31, group = 'Time filters')
FromYear=input.int(defval=2000,title="FromYear",minval=1990, group = 'Time filters')
ToMonth=input.int(defval=1,title="ToMonth",minval=1,maxval=12, group = 'Time filters')
ToDay=input.int(defval=1,title="ToDay",minval=1,maxval=31, group = 'Time filters')
ToYear=input.int(defval=9999,title="ToYear",minval=2017, group = 'Time filters')
start=timestamp(FromYear,FromMonth,FromDay,00,00)
@iCodeForBananas
iCodeForBananas / paperTradingOS.js
Last active August 2, 2023 16:34
paperTradingOS.js
// ==UserScript==
// @name OS Paper Trading
// @version 15
// @description Lets you trade off of replay mode so that you can keep track of practice sessions.
// @match https://app.oneoption.com/option-stalker/chart-dev/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=oneoption.com
// @grant none
// ==/UserScript==
(function () {
Inputs:
TradeSize(1),
EmaLength(30),
StopSize(10);
Variables:
Ema(0),
PriorBarHigh(0),
PriorBarLow(0);
//@version=5
// @MNQ on M5 M15 and M30
strategy("MA Price Cross w/ Trail Points Strategy", overlay=true, initial_capital = 5000, default_qty_value = 1, pyramiding = 0)
maLength = input(30, 'Trigger EMA length', group = 'Filter')
closeTradesEOD = input.bool(true, 'Close trades end of day', group = 'Risk')
// Time Range
timeAllowed = input.session("0830-1430", "Allowed hours", group = 'Time filters')
timeIsAllowed = time(timeframe.period, timeAllowed + ":1234567")
@iCodeForBananas
iCodeForBananas / bullish_engulfing.pine
Created April 8, 2023 15:57
EMA + Bullish Engulfing Candle Pattern Strategy by DuDu95 copy
// @version=5
// # ========================================================================= #
// # | STRATEGY |
// # ========================================================================= #
strategy(
title = "fpemehd Strategy001",
shorttitle = "f_001",
overlay = true,
default_qty_type = strategy.percent_of_equity,
default_qty_value = 100,