Skip to content

Instantly share code, notes, and snippets.

@rwilkes
rwilkes / Register-ArgumentCompleter.ps1
Created February 12, 2022 02:09
Register-ArgumentCompleter
Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
[Console]::InputEncoding = [Console]::OutputEncoding = $OutputEncoding = [System.Text.Utf8Encoding]::new()
$Local:word = $wordToComplete.Replace('"', '""')
$Local:ast = $commandAst.ToString().Replace('"', '""')
winget complete --word="$Local:word" --commandline "$Local:ast" --position $cursorPosition | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# Get a list of all files across all changesets inside of a given query in TFS
# Ever find yourself needing to know all of the files that were changed as part of a group of work items
# because... reasons
# Well this script will help you out as it will go through each of them and emit the files in each change set
# duplicates will appear if the same file is used across several changesets, but you can always filter them out
# in another program.
# You'll need to Install-Module -Name TfsCmdlets to use the Get-TfsWorkItemLink portion
@rwilkes
rwilkes / MomentumPriceOscillator.ts
Created March 22, 2020 15:33
Momentum Price Oscillator - If both volume and price are in agreement then the probability is that the tend will extend. If volume doesn't increase at the beginning of a new trend the probability is that price will contract again. The study colors the bars to match the histogram. It also indicates divergence where price is coninuing to rise whil…
# Momentum Price Oscillator
# Mobius
# V.02
# Detrended avg for momentum and weighted it with a derivative of volume.
# If momentum (clouded green and red oscillator is increasing price will increase in momentum with the oscillators direction. If momentum is decresing price movement is not sustainable and any trend will shortly end.
@rwilkes
rwilkes / TOSStrategyTemplate.ts
Created March 22, 2020 07:15
ThinkScript: Code Template for Writing Strategjes
# thinkscript strategy template
##############################################################
####################### Strategy Setup #####################
##############################################################
# Common settings for studies
input length = 14;
input over_sold = 20;
input over_bought = 80;
@rwilkes
rwilkes / VIX_FGMR.ts
Created March 22, 2020 07:10
ThinkScript: $VIX Mean Reversion Study
#
# $VIX Fear & Greed Mean Reversion Study (VIX_FGMR)
#
# This script adapted from posts from @kerberos007
# https://twitter.com/kerberos007
#
# Want the latest version of this script?
# https://github.com/korygill/technical-analysis
#
# Use on thinkorswim and thinkscript
@rwilkes
rwilkes / PlotHmaStop.ts
Created March 22, 2020 07:09
Plots 5 day stops
plot x = lowest(low, 5);
@rwilkes
rwilkes / HMA1020Shader.ts
Created March 22, 2020 07:08
ThinkScript for shading the 10 and 20 day Hull Moving Average
# follow @KRose_TDA on twitter for updates to this and other scripts
# creates a cloud between two HullMovingAvg movingAverage averages
input FastHullMaMaLength = 10;
input SlowHullMaLength = 20;
def FastHull = reference HullMovingAvg("length" = FastHullMaMaLength);
def SlowHull = reference HullMovingAvg("length" = SlowHullMaLength);
AddCloud(FastHull, SlowHull, Color.GREEN, Color.RED, yes);
<#
.SYNOPSIS
Output statistics from a thinkorswim strategy file exported as csv.
.PARAMETER File
Name or of csv file to process.
.PARAMETER ShowFileContents
If true, will output the contents of the csv file and calculated properties.
@rwilkes
rwilkes / ScalpingStrategy.ts
Created March 22, 2020 06:47
ThinkScript: Scalping Strategy
# Scalper
# DREWGRIFFITH15 (C) 2015
# inputs based on 2 minute chart
declare upper;
input price = close;
input BBlength = 12;
input FSOkperiod = 10;
@rwilkes
rwilkes / SuperTrendScanner.ts
Created March 22, 2020 06:34
ThinkScript: Scanner
# SuperTrend Scan
# Mobius
# V01.10.2015
# Comment out (#) the direction NOT to use for a scan
input AtrMult = .70;
input nATR = 4;
input AvgType = AverageType.HULL;
def h = high;
def l = low;