/stonks-jupyter

Jupyter notebooks for chart patterns backtesting

Primary LanguageJupyter Notebook

stonks-jupyter (work-in-progress)

Jupyter notebooks for chart patterns backtesting

pattern queries below are meant to be used in this notebook: https://github.com/rndbblnn/stonks-jupyter/blob/main/charting.ipynb

stock patterns

higher low & over previous day's high (green trades only, for study)

https://github.com/rndbblnn/stonks-jupyter/blob/main/higher-low-and-over-previous-day-high.ipynb

[d]C.0 / [d]C.5 >= 1.2 \n\
AND [d]H.5 > [d]H.6 \n\
AND [d]L.6 > [d]L.7 \n\
AND [d]H.6 <= [d]H.7 \n\
AND [d]C.0 > [d]AVGC50.0 \n\
AND (\n\
  [d]C.0 > [d]C.1 \n\
  AND [d]C.1 > [d]C.2 \n\
  AND [d]C.2 > [d]C.3 \n\
  AND [d]C.3 > [d]C.4 \n\
  AND [d]C.4 > [d]C.5 \n\
)\n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

image

image

SMAs all up & gap up

[d]O.0 / [d]C.1 > 1.2 \n\
AND [d]C.1 > [d]AVGC20.0 \n\
AND [d]AVGC10.0 > [d]AVGC20.0 \n\
AND [d]AVGC20.0 > [d]AVGC50.0 \n\
AND [d]AVGC50.0 > [d]AVGC100.0 \n\
AND [d]AVGC100.0 > [d]AVGC200.0 \n\
AND [d]AVGC100.0 > [d]AVGC200.0 \n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

SMAs all up and fakeout

[d]H.0 * 0.99 > [d]MAXH20.1 \n\
AND [d]H.1 < [d]MAXH20.2 \n\
AND [d]H.2 < [d]MAXH20.3 \n\
AND [d]H.3 < [d]MAXH20.4 \n\
AND [d]C.0 < [d]O.0 \n\
AND [d]C.0 < [d]C.1 \n\
AND [d]C.1 < [d]AVGC50.0 \n\
AND [d]AVGC10.0 < [d]AVGC20.0 \n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

1st red day

[d]C.0 < [d]C.1 \n\
AND [d]C.0 < [d]O.0 \n\
AND [d]C.1 > [d]C.2 \n\
AND [d]C.2 > [d]C.3 \n\
AND [d]C.3 > [d]C.4 \n\
AND [d]C.4 > [d]C.5 \n\
AND [d]C.5 > [d]C.6 \n\
AND [d]C.1 > [d]AVGC20.0 \n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

downtrending & touching EMA 50

[d]H.0 / [d]AVGC50.0 >= 0.98 \n\
AND [d]H.0 / [d]AVGC50.0 <= 1.02 \n\
AND [d]C.0 / [d]C.50 <= 0.6 \n\
AND (\n\
    #[d]AVGC10.0 < [d]AVGC20.0 \n\
    [d]AVGC20.0 < [d]AVGC50.0 \n\
    AND [d]AVGC50.0 < [d]AVGC100.0 \n\
    AND [d]AVGC100.0 < [d]AVGC200.0 \n\
)\n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

First close under EMA 200

[d]C.1 / [d]C.250 >= 2.0 \n\
AND [d]C.0 < [d]AVGC200.0 \n\
AND (\n\
    [d]C.1 > [d]AVGC200.1 \n\
    AND [d]C.2 > [d]AVGC200.2 \n\
    AND [d]C.3 > [d]AVGC200.3 \n\
    AND [d]C.4 > [d]AVGC200.4 \n\
    AND [d]C.5 > [d]AVGC200.5 \n\
    AND [d]C.6 > [d]AVGC200.6 \n\
    AND [d]C.7 > [d]AVGC200.7 \n\
    AND [d]C.8 > [d]AVGC200.8 \n\
    AND [d]C.9 > [d]AVGC200.9 \n\
)\n\
AND (\n\
    [d]AVGC10.0 < [d]AVGC20.0 \n\
    AND [d]AVGC20.0 < [d]AVGC50.0 \n\
    AND [d]AVGC50.0 < [d]AVGC100.0 \n\
    AND [d]AVGC100.0 < [d]AVGC200.0 \n\
)\n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

image

image

up big, first time below 50 with downtrending 10&20

image

MA cluster (e10-e20-s50)

image

SMAs all up (except 10) dip buy

image

SMAs all down under previous low (10 & 20 pointing down)

[d]L.0 < [d]L.1 \n\
AND [d]AVGC10.0 < [d]AVGC20.0 \n\
AND [d]AVGC10.0 < [d]AVGC10.1 \n\
AND [d]AVGC20.0 < [d]AVGC50.0 \n\
AND [d]AVGC20.0 < [d]AVGC20.1 \n\
AND [d]AVGC50.0 < [d]AVGC100.0 \n\
AND [d]AVGC100.0 < [d]AVGC200.0 \n\
AND (\n\
    [d]DV.0 > 1.0 \n\
    OR [d]MINDV3.1 > 2.0\n\
    OR [d]AVGDV20.0 > 3.0\n\
)\n\
AND (\n\
    [d]ATR1.0 > 8.0 \n\
    OR [d]ATR20.0 > 5.0 \n\
    OR [d]ATR20.20 > 5.0 \n\
    OR [d]ATR20.40 > 5.0 \n\
)\

image

image

image