Skip to content

Instantly share code, notes, and snippets.

View 18182324's full-sized avatar
🎯
Focusing

Wealth Hub 18182324

🎯
Focusing
View GitHub Profile
@18182324
18182324 / OpenDayRangeSP500
Last active May 12, 2024 15:27
Opening Range Breakout OHLC [Python]
from pandas import *
from datetime import *
import pdb as pdb
df = DataFrame.from_csv('aapl_1-2012_5min.csv')
dayCount=0
rangeHigh = -1
rangeLow = 9999
openDayRangeDict = {}
getRange = 1
@18182324
18182324 / Pairs Trading Strategy Backtest for cointegration method [Python Code]
Created July 27, 2020 13:54
Pairs Trading Strategy Backtest for cointegration method [Python Code]
from sklearn import linear_model
import numpy as np
import pandas as pd
from scipy import stats
from math import floor
from datetime import timedelta
class PairsTradingAlgorithm(QCAlgorithm):
@18182324
18182324 / Pairs Trading Strategy Backtest for copula method [Python Code]
Last active February 7, 2023 02:57
Pairs Trading Strategy Backtest for copula method [Python Code]
import numpy as np
from scipy import stats
from statsmodels.distributions.empirical_distribution import ECDF
from scipy.stats import kendalltau, pearsonr, spearmanr
from scipy.optimize import minimize
from scipy.integrate import quad
import sys
from collections import deque
@18182324
18182324 / Range Bound Strategy [EasyLanguage Code]
Created March 30, 2020 14:32
Range Bound Strategy [EasyLanguage Code]
INPUT:
MAXFLDUR(15), //Max Flag Duration
FLAGMIN(2.5), // Max Atr in lowest point in flag
PX(23), //Max Pole Duration.
UPT1BARS(70), // Bars for Uptrend leading to flag
POLEMIN(5.5), //Min ATR Height of the pole
LBF(50), // Min distance between flags
ATRmin(5),// Min volatility change
K(1.2), //Profit Target constant
timeexit(100), //Time exit bars
}
variables:
Event( false ),
FuturePrice( 0 ),
j( 0 ),
CG( 0 ),
Denom( 0 ) ;
arrays:
PredictBin[100]( 0 );
EasyLanguage Code To TesT The Predictability Of An Event
Vars:
Event(false),
FuturePrice(0),
I(0),
CG(0),
Denom(0);
Arrays:
PredictBin[100](0);