Skip to content

Instantly share code, notes, and snippets.

@trAve3113r
Last active April 12, 2018 20:44
Show Gist options
  • Save trAve3113r/5a2c59c6e1bfcd8677a69e1ca577c4d6 to your computer and use it in GitHub Desktop.
Save trAve3113r/5a2c59c6e1bfcd8677a69e1ca577c4d6 to your computer and use it in GitHub Desktop.
import pandas pd
import numpy as np
from pandas import *
# create a dataframe with the last candles bars being an inside_bar pattern
# bullish_candle: close > open
# bearish_candles: open > close
# mother_bar :: open = 70.123 , high =102.634 ,low = 80.021 , close = 97.653
# inside_bar :: open = 99.179 , high = 100.876, low = 75.656 , close = 73.745
# assumes an ideal up_trend market(use bearish hammer or inverted)
# bearish_inverted_hammer:: o=93.456,h=98.865,l=90.465,c=89.765
# bearish_hammer:: o=98.245,h=98.865,l=90.465,c=97.456
# bullish_hammer:: o=96.987, h=98.865, l=90.465, c=98.125
# ---------------------------------------------------------------#
open_lst = [70.537 , 75.343, 80.654, 94.978, 95.737,70.123,99.179]
high_lst = [95.765,97.632,98.345,98.654,100.098,102.634,100.876]
low_lst = [70.007,72.678,73.097,73.654,74.021,75.656,80.021]
close_lst = [92.654,94.456,95.737,96.897,97.025,97.653,73.745]
d = ['open':open_lst, 'high':high_lst, 'low': low_lst, 'close': close_lst]
#df = pd.DataFrame(columns=cols,,index=range(1,x))
df = pd.DataFrame(data=d)
# test the inside_bar algo :: vary the inside_pin for various scenarios
# ideally plot this dataframe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment