I have back-tested my trading strategy using pandas data-frames and found the win-rate, sharpe ratio etc.
import pandas as pd
import talib
import numpy as np
import matplotlib.pyplot as plt
import mplfinance as mpf
import xx
in_csv="AXSUSDT-1m-2021-06.csv"
out_csv="OUT.csv"
ema_period=200; xx.RR=1.5
column_heads=["Date", "Open", "High","Low", "Close","Vol"]
df = pd.read_csv(in_csv, usecols=[0,1,2,3,4,5],names=column_heads, header=None)
df["Date"]=(pd.to_datetime(df["Date"],unit='ms'))
df["M"],df["S"],df["H"] = talib.MACD(df["Close" ], fastperiod=12, slowperiod=26, signalperiod=9)
#df["M"]=m;df["S"]=s;df["H"]=h
#EMA
ema = talib.EMA(df["Close"], timeperiod=ema_period)
df["EMA"]=ema
#STACK OVERFLOW
df = df = xx.green(df);xx.red(df);df = xx.histo2(df);df = xx.histo1(df);df = xx.short_dive(df);df = xx.long_dive(df);df = xx.jump_dive(df);df = xx.h2(df);df = xx.h1(df);df = xx.l2(df);df = xx.l1(df);df = xx.mh2(df);df = xx.mh1(df);df = xx.ml2(df);df = xx.ml1(df);df = xx.ch2(df);df = xx.ch1(df);df = xx.cl2(df);df = xx.cl1(df);df = xx.position(df);df=xx.exits(df);df=xx.cerebro(df)
df.to_csv(out_csv)
The result of the above code gives a back-tested data-frame with entry,loss or profit.
The issue is how to pull this off in the live market. I don't know how to go about implementing this to a live feed data.
I need to calculate the entry price, stop-loss, take-profit and volume and before placing an order.
I actually set up Trading-view alert which returns the stop-loss, takep-rofit,volume to trade...to my Gmail inbox..
Is there a way to scrape the data from my Gmail feed and execute the trade with the scraped parameters.
Or should I code something to receive data from and calculate the trade trigger from my end.