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 / profile.ps1
Created December 8, 2025 06:01
linux commands in my powershell
# Linux-like compatibility layer for PowerShell
# ----- navigation / shell -----
function cd {
param([string]$Path = $HOME)
Set-Location $Path
}
function pwd { Get-Location }

1. JavaScript Fundamentals — Interview Questions

  1. What are closures, and how does JavaScript handle scope?
  2. How does the event loop work?
  3. What is the difference between the event queue and the microtask queue?
  4. How do Promises work? How does async/await simplify them?
  5. What is hoisting, and how does it apply to variables and functions?
  6. How does the this keyword behave in different contexts?
  7. How does prototypal inheritance work in JavaScript?
  8. What is event delegation, and why is it beneficial?
@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);