---
# System prepended metadata

title: Algo-trading-2021 Strategies

---

Algo-trading-2021 Strategies
===

## General Logic for All Strategies

We need
* a data frame that keeps track of currently open trades
* a record of all trades we have made (for later analysis) -- written to a csv file for record-keeping

**Functions**


* 
```python 
def check_entry_conditions(signals:dict)  -> boolean: 
"""
determines whether or not it is time to open a new trade
"""
```

* 

```python 
def open_trade(**args) -> data
"""
performs the mechanical heavy lifting of opening the trade
"""
```

* 
```python
def add_trade_to_df(trade):
"""
writes information about the trade to the current data frame
"""
```




---
# :black_square_for_stop: Strategy


## 1. SMA-KDJ

- Ticker: BTCUSD 
- tf: 30m
- Indicators
    - 21 SMA
    - KDJ - period 9, signal 3
    - ATR - 14

- Entry
    - LONG: candle closes above 21sma and kdj indicates long
    - SHORT: candle closes below 21sma and kdj indicates long

- Logic
    - 80% accn value with take profit 1*ATR(trade open candle) SL:1.5*ATR
    - 20% accn value, SL: 1.5*ATR
        - EXIT: - Close rest 20% position when trend changes
    
- Notes on KDJ
    - https://www.iqoptionwiki.com/kdj-indicator-on-iq-option/
    
- Possible Improvements
    - Using ADX or ATR along with KDJ



---
## Lerning notes

**1. Post Only Order**

It only places order as maker,
https://help.ftx.com/hc/en-us/articles/360031896592-Advanced-Order-Types

---
## Future work

1) Using websockets for fetching ohlcv data
2) VPS to resolve connection error issue
3) Trading system
    ![](https://i.imgur.com/wmDANJ5.png)
