Skip to content

Instantly share code, notes, and snippets.

View feliperazeek's full-sized avatar
💭
Be there and give a shit

Felipe Oliveira feliperazeek

💭
Be there and give a shit
View GitHub Profile
@feliperazeek
feliperazeek / donchian.pine
Created April 10, 2025 11:49
Donchian Channel Strategy
//@version=5
strategy("Donchian Breakout Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10, commission_type=strategy.commission.percent, commission_value=0.045)
// === Inputs ===
entryLen = input.int(20, "Donchian Entry Length", minval=1)
exitLen = input.int(10, "Donchian Exit Length", minval=1)
atrLength = input.int(14, "ATR Length", minval=1)
atrMult = input.float(1.5, "ATR Stop Multiplier", minval=0.1)
emaLen = input.int(50, "EMA Trend Filter Length")
//@version=5
strategy("NakInvest - 123 Strategy (Full Control)", overlay=true,
default_qty_type=strategy.percent_of_equity,
default_qty_value=1,
commission_type=strategy.commission.percent,
commission_value=0.045)
// === INPUTS ===
// Pattern
minBodyRatio = input.float(0.7, "Min Body Size Ratio (Candle 3 vs 1)", minval=0.1, group="123 Pattern")
//@version=5
indicator("NakInvest - PFR Identifier", overlay=true)
// === PFR CONDITIONS ===
reversalBody = math.abs(close - open)
prevBody1 = math.abs(close[1] - open[1])
prevBody2 = math.abs(close[2] - open[2])
bullishCandle = close > open
bearishCandle = close < open
@feliperazeek
feliperazeek / prf.pine
Created March 9, 2025 14:22
NakInvest - PFR
//@version=5
strategy("NakInvest - PFR Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=10)
// === INPUTS ===
shortEmaLength = input.int(9, title="Short EMA Length")
longEmaLength = input.int(100, title="Long EMA Length")
stochLength = input.int(8, title="Stochastic Length")
stochK = input.int(3, title="Stoch %K Smoothing")
stochD = input.int(3, title="Stoch %D Smoothing")
rsiLength = input.int(8, title="RSI Length")
@feliperazeek
feliperazeek / bullish-candles.pine
Created March 8, 2025 18:51
NakInvest - Bullish Candles
//@version=5
indicator("NakInvest - Bullish Candlestick Patterns", overlay=true)
// Function to identify a Hammer pattern
isHammer() =>
lowerShadow = low < close - (high - low) * 0.5
upperShadow = high - close < (high - low) * 0.1
bodySize = math.abs(close - open)
bodySize < (high - low) * 0.3 and lowerShadow and upperShadow
@feliperazeek
feliperazeek / inversao-polaridade.pine
Last active March 8, 2025 18:52
Trading View - Inversao de Polaridade
//@version=5
indicator("NakInvest - Bullish Candlestick Patterns with Doji", overlay=true)
// Function to identify a Hammer pattern
isHammer() =>
lowerShadow = low < close - (high - low) * 0.5
upperShadow = high - close < (high - low) * 0.1
bodySize = math.abs(close - open)
bodySize < (high - low) * 0.3 and lowerShadow and upperShadow
@feliperazeek
feliperazeek / IcebergTableStatsTest.scala
Created April 8, 2024 16:10
Iceberg Lower/Upper Bounds in Data Files (Parquet vs Avro)
import org.apache.hadoop.conf.Configuration
import org.apache.iceberg.hadoop.HadoopFileIO
import org.apache.iceberg.spark.Spark3Util
import org.apache.iceberg.{DataFile, Snapshot, TableProperties, Table => IcebergTable}
import org.apache.spark.SparkConf
import org.apache.spark.sql.functions._
import org.apache.spark.sql.types.{StringType, StructField, StructType, TimestampType}
import org.apache.spark.sql.{DataFrame, Row, SparkSession}
import org.junit.runner.RunWith
import org.scalatest.BeforeAndAfterAll
@feliperazeek
feliperazeek / IcebergResidual2Test.scala
Created March 14, 2024 19:26
Iceberg Residual Test
import org.apache.hadoop.conf.Configuration
import org.apache.iceberg.hadoop.HadoopFileIO
import org.apache.iceberg.spark.Spark3Util
import org.apache.iceberg.{DataFile, PartitionSpec, Schema, Snapshot, TableMetadata, TableMetadataParser, Table => IcebergTable}
import org.apache.spark.SparkConf
import org.apache.spark.sql.functions._
import org.apache.spark.sql.types.{StringType, StructField, StructType, TimestampType}
import org.apache.spark.sql.{DataFrame, Row, SparkSession}
import org.junit.runner.RunWith
import org.scalatest.BeforeAndAfterAll
@feliperazeek
feliperazeek / ty-turtle-jump.py
Created May 24, 2022 20:04
Ty's Python Turtle Game
import turtle
import random
t = turtle.Turtle()
scorey = turtle.Turtle()
score = 0
t.goto(0,0)
scorey.penup()
scorey.goto(200,200)
t.setheading(90)
c = turtle.Turtle()
{
"type" : "record",
"name" : "twitter_schema",
"namespace" : "foo.bar",
"fields" : [ {
"name" : "username",
"type" : "string",
"doc" : "Name of the user account on Twitter.com"
}, {
"name" : "tweet",