Skip to content

Instantly share code, notes, and snippets.

View princefr's full-sized avatar
😀
good

Princefr princefr

😀
good
  • Swootte
  • Paris - France
View GitHub Profile
@princefr
princefr / backtest ma
Created June 24, 2020 15:24
backtest ma
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © prince_ond
//@version=4
strategy(title='[STRATEGY][UL]MA strategy', pyramiding=0, overlay=true, initial_capital=20000, calc_on_every_tick=false,
currency=currency.USD, default_qty_type=strategy.percent_of_equity, default_qty_value=100)
ma = ema(close, 50)
ma_color() => ma[5] > ma[2] ? color.red : color.green
ma__isdown() => ma[5] > ma[2]
ma_is_up() => ma[5] < ma[2]
@princefr
princefr / ma_changing
Last active June 24, 2020 13:48
ma_alert is changing color
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © prince_ond
//@version=4
study("Mon Script", overlay=true)
ma = ema(close, 20)
ma_color() => ma[5] > ma[2] ? color.red : color.green
ma__isdown = ma[5] > ma[2]
ma_is_up = ma[5] < ma[2]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © prince_ond
//@version=4
study("mon script", shorttitle="Spartiate")
// === INPUTS ===
uDiv = input(true,"Show Divergence Channel")
multi = input(0.5, minval=0.0, maxval=3.0, title="Divergence Channel Width Factor (Stddev)")
from Binance import Binance_Wrapper
from flask import Flask, request
import os
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © prince_ond
//@version=4
study("VWAPD[Liquidator]", overlay=true)
k = sma(vwap(close), 3)
d = sma(k, 3)
p4 = plot(k, color=color.blue, title="vwap-A", transp=100)
p5 = plot(d, color=color.orange, title="vwap-B", transp=100)
@princefr
princefr / div_pine
Created May 9, 2020 15:11
divergences pines
//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © pondonda
study("Divergence", shorttitle="Divergence[BBQDiv]", overlay=true)
uHid = input(true, title="Use Hidden Divergence in Strategy")
uReg = input(true, title="Use Regular Divergence in Strategy")
//@version=3
study("Fibonacci Zone", overlay=true)
per=input(21, "calculate for last ## bars")
hl=highest(high,per) //High Line (Border)
ll=lowest(low,per) //Low Line (Border)
dist=hl-ll //range of the channel
hf=hl-dist*0.236 //Highest Fibonacci line
cfh=hl-dist*0.382 //Center High Fibonacci line
cfl=hl-dist*0.618 //Center Low Fibonacci line
lf=hl-dist*0.764 //Lowest Fibonacci line
@princefr
princefr / CTPU
Last active November 1, 2019 19:05
CTPU engines with PyTorch
gcloud config set compute/zone us-central1-f # change the compute zone.
ctpu up --tpu-size=v3-8 --machine-type n1-standard-8 # create a tpu v3 machine + 8 nodes
tpu succesfully created ?
connect to gcloud vm instance, if you don't have one create one
docker pull gcr.io/tpu-pytorch/xla:r0.5 # pull pytorch xla into the vm
docker run -it --shm-size 16G gcr.io/tpu-pytorch/xla:r0.5
class KeypointRCNN(FasterRCNN):
"""
Implements Keypoint R-CNN.
The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
image, and should be in 0-1 range. Different images can have different sizes.
The behavior of the model changes depending if it is in training or evaluation mode.
During training, the model expects both the input tensors, as well as a targets (list of dictionary),
if __name__ == '__main__':
load_model()
# Adding some arg to a parser so its easy to manage
parser = argparse.ArgumentParser()
parser.add_argument('-src', '--source', dest='video_source', type=int, default=0, help='Device index of the camera.')
parser.add_argument('-wd', '--width', dest='width', type=int, default=320, help='Width of the frames in the video stream.')
parser.add_argument('-ht', '--height', dest='height', type=int, default=360, help='Height of the frames in the video stream.')
args = parser.parse_args()