Skip to content

Instantly share code, notes, and snippets.

@bongkook
bongkook / extractimages.py
Last active August 29, 2015 13:57
Only image files with the HTML parsing and extraction
# -*- coding: utf-8 -*-
import re, sys
def extractimgs(html):
exp = re.compile(r'<img.+?src="(http://imgcomic\.naver\.net/webtoon/[0-9]+/[0-9]+/(.+?\.(jpg|png|gif)))".*?>')
imgs = exp.findall(html)
return imgs
def main(argv):
@bongkook
bongkook / gethtml.py
Created March 9, 2014 12:28
Reading the file stored in the HTML
# -*- coding: utf-8 -*-
import urllib2
import sys
def savefile(contents, filename):
f = open(filename, 'w')
f.write(contents)
f.close()
@bongkook
bongkook / add_column.awk
Created April 12, 2014 02:42
CSV形式ファイルに列(Column)を追加するAWKスクリプト ref: http://qiita.com/bongkook/items/9748c7114983056f4c88
#!/bin/gawk -f
#./add_column.awk col=[num] val=[value] quot=[true] [filename] > [new filename]
BEGIN{
FS=","
}
{
split($0,cols,",");
rec = ""
for (i=0;i<length(cols);i++) {
@bongkook
bongkook / [PineScript]Heikin Ashi Strategy Example
Last active November 27, 2021 20:16
TradingView Strategies
// NOTE: Add this strategy on a usual candles chart, NOT on a HeikinAshi chart.
//@version=3
strategy("Heikin Ashi Strategy Example", overlay=true)
haTicker = heikinashi(tickerid)
haOpen = security(haTicker, period, open)
haClose = security(haTicker, period, close)
longCondition = haClose > haOpen and haOpen > haClose[1]
exitCondition = haClose < haOpen
@bongkook
bongkook / [PineScript]CM_Modified_Heik_Trend_Bars
Last active October 16, 2019 03:32
TradingView Indicators
//Created by Chrismoody on 7/22/2014 By Request for user lucalucious
//Modified Heikinashi with EMA Filter...
//Choice To Plot EMA Trend Is Based Off Of
study(title = "CM_Modified_Heik_Trend_Bars", shorttitle="CM_TrendBars",overlay=true)
note = input(false, title="Lower Numbers = More Sensitive to Price Change...Higher Numbers = Less Sensitive")
uema = input(34, minval=1, maxval=50, title="EMA UpTrend")
dema = input(34, minval=1, maxval=50, title="EMA DownTrend")
shema = input(false, title="Show EMA Trend is Based On?")
haclose = (open + high + low + close)/4
エントリー
RSIが30以下の地点で、RSIがRSIの移動平均線(以下RSIシグナル)をゴールデンクロスしたら買い
エグジット
RSIが80より大きい地点から80未満になった地点利食い
損切り
過去10日間の最安値を割ったら損切り
strategy(title = "RSI大底ルール")
// rsiの日数
rsiDays = input(type = integer, title = "RSIの日数", defval = 10, minval = 3, maxval = 20, step = 1)
https://www.fxbroadnet.com/tech/technicalchart/
//------------------------------------
//
// バックテスト用ストラテジーファイル
//
//------------------------------------
//【説明】バックテスト用のPineスクリプトです。
//------------------------------------
//@version=3
//バックテスト時の初期資金などの設定は投資戦略テスターのタブの歯車アイコンから設定することができます。
//パラメーターはヘルプを参照してください。
//@version=2
//Heikin Ashi Strategy V2 by breizh29
strategy("Heikin Ashi Strategy V2",shorttitle="HAS V2",overlay=true,default_qty_value=1000,initial_capital=100000,currency=currency.EUR)
res = input(title="Heikin Ashi Candle Time Frame", type=resolution, defval="60")
hshift = input(1,title="Heikin Ashi Candle Time Frame Shift")
res1 = input(title="Heikin Ashi EMA Time Frame", type=resolution, defval="180")
mhshift = input(0,title="Heikin Ashi EMA Time Frame Shift")
fama = input(1,"Heikin Ashi EMA Period")
test = input(1,"Heikin Ashi EMA Shift")
//@version=2
study("Heiken Ashi MTF")
ha_t = heikinashi(tickerid)
res = input('60', title="TM 1")
ha_open = security(ha_t, res, open)
ha_close = security(ha_t, res, close)
ha_dif = ha_open-ha_close
ha_diff=iff(ha_dif > 0, 1, iff(ha_dif<0, 2, 3))