Visualizzazione post con etichetta alghoritm. Mostra tutti i post
Visualizzazione post con etichetta alghoritm. Mostra tutti i post

mercoledì 26 agosto 2020

PYTHON - MA and BOOKORDER SCALPING


Scalping signal indicator written in python. It is based on Binance data.
The simpleBinanceFut.py module can be downloaded from GitHub.
https://github.com/DanielePorcari/simpleBinanceFutures

import simpleBinanceFut as sBF

def MA(dati,periodo):
    ris=0
    i=len(dati)-1
    for c in range(periodo):
        if i>=periodo:
            prezzo=(float(dati[i][4]))
            ris=ris+prezzo
            i-=1
    ris=ris/periodo
    return ris

def bookBot(up):
    volMax=0
    priceMax=0
    if up:
        for i in range(len(book['bids'])):
            price=float(book['bids'][i][0])
            vol=float(book['bids'][i][1])
            if float(vol)>float(volMax):
                volMax=vol
                priceMax=price
        print("Buy: ",priceMax)
        volMax=0
        priceMax=0
        for i in range(len(book['asks'])):
            price=book['asks'][i][0]
            vol=book['asks'][i][1]
            if float(vol)>float(volMax):
                volMax=vol
                priceMax=price
        print("TP: ",priceMax)
    else:
        for i in range(len(book['asks'])):
            price=float(book['asks'][i][0])
            vol=float(book['asks'][i][1])
            if float(vol)>float(volMax):
                volMax=vol
                priceMax=price
        print("Sell: ",priceMax)
        volMax=0
        priceMax=0
        for i in range(len(book['bids'])):
            price=book['bids'][i][0]
            vol=book['bids'][i][1]
            if float(vol)>float(volMax):
                volMax=vol
                priceMax=price
        print("TP: ",priceMax)

coppia=input("Insert asset: ")
print("Last price: ",sBF.fbin_ultimo_prezzo(coppia))
tf=input("Insert tf:")
book=sBF.fbin_book(coppia)
prezzi=sBF.fbin_candlestick(coppia,tf,"99")
ma9=MA(prezzi,50)
ma25=MA(prezzi,25)
if ma9>ma25:
    up=True
else:
    up=False
bookBot(up)

domenica 19 aprile 2020

PYTHON - MACD ALGORITHM

MACD is a momentum indicator. This algorithm will search for the divergences between price and indicator independently. It will find the trend automatically and then look for convergence.
Here you can see the script that builds only the MACD.

The vectorMA function builds the two moving average lists that will be used to build the MACD.
def vettoreMA(dati,periodo):
    itad=[]
    vMediaINV=[]
    mediaFinale=[]
    i=len(dati)
    c=0
    prov=0
    conta=0
    while i >0 :
        itad.append(dati[c])
        c+=1
        i-=1
    long1=len(itad)//int(periodo)
    for i in range(len(itad)-int(periodo)):
        for c in range(periodo):
            prov=float(itad[i+c][4])+prov
        vMediaINV.append(prov/periodo)
        prov=0
    i=len(vMediaINV)
    c=0
    while i >0:
        mediaFinale.append(vMediaINV[c])
        c+=1
        i-=1
    return mediaFinale

def vettoreMACD(mediasmall,mediabig):
    macd=[]
    for i in range(len(mediabig)):
        macd.append(mediabig[i]-mediasmall[i])
    return macd

PYTHON IA BINANCE API PIVOT CALCULATOR V.2

In this new version there is the possibility to automatically calculate the Fibonacci levels between the levels where the price is located. 


If you like you can help me continue the research on my AI written in Python by donating crypto currencies or by donating here

You can download the software from this link: PivotCalculator. If you are interested in the sources contact me.