cryptocurrency – binance macd script in python language

def initialize(state):
    state.counter = 0


if state.counter < 4:
state.counter += 1
state.counter = 0

 if counter == 4: (every four hours)

macd = data.macd(12,26,9)
signalLine = macd(‘macd_signal’)

- Check if bot has position

has_position = has_open_position(data.symbol, truncated=True)

import numpy as np

def initialize(state):

state.counter = 0

@schedule(interval="1h", symbol="BTCTUSD")

def handler(state, data):

angle = 0

macd_ind = data.macd(12,26,9)

if macd_ind is None:


signal = macd_ind('macd_signal')

has_position = has_open_position(data.symbol, truncated=True)

balance_base = float(query_balance_free(data.base))

balance_quoted = float(query_balance_free(data.quoted))

buy_amount = balance_quoted * 0.80 / data.close_last


if state.counter < 4:

state.counter += 1


state.counter = 0

if state.counter == 4:

lastsignals = signal(-4:)

# calculating the slope of last 4 candles

slope = (lastsignals(-1) - lastsignals(0)) / 3

angle = np.rad2deg(np.arctan(slope))

print("slope: ",slope)

print("angle: ",angle)

plot("angle of signal",angle,"BTCTUSD")

if angle > 30 and balance_base<buy_amount:


print("Checking for buying possibility of {}".format(data.symbol))

print("buy amount:",buy_amount)

print("buy price:", data.close_last)

create_order(symbol=data.symbol,amount = buy_amount)

elif angle < -30 and has_position:


print("Checking for selling possibility of {}".format(data.symbol))

print("sell amount:",balance_base)

print("sell price:",data.close_last)


The first state.counter = 0 should be indented. But aside from that I have this error message:

> Engine error:   File "", line 19.
> Engine error:     if state.counter < 4:.
> Engine error:      ^.
> Engine error: SyntaxError: invalid syntax.
>   File "", line 19
    if state.counter < 4:
SyntaxError: invalid syntax

The script is meant to be used on binance for automated trading. The point is to look at the slope of macd line on a 4 hour macd candle interval. This was given to me as a pseudo code so I guess there are some things that need to be changed. Thank you

Mapping the Cryptocurrency Markets

Why are you selling this site?

How is it monetized?

Does this site come with any social media accounts?

How much time does this site take to run?

What challenges are there with running this site?

Does Cryptocurrency really need timestamps?

Bitcoin is supposed to be a clock on it’s own right so it always felt sketchy to me that outside time is referenced. Could bitcoin be aware of it’s own block interval through something like uncle block rate? Could that allow it to do difficulty adjustment without reference to outside time?

What are some basic ideas for making money in the crypto industry? – Cryptocurrencies Corner

Are you looking into how you could earn some money from the crypto industry? There are many ways to earn money from the crypto industry. In those ways, one of the simpleset & safest methods to earn money is to start own cryptocurrency exchange platform.
The cryptocurrency exchange is the most demanded crypto business in the modern world. So finding the best bitcoin clone script provider is a risky one. One of the best & successful cryptocurrency exchange script providers, Coinsclone got my attention. They are the earlier adopters of this industry. They offer some unique features & world-class exchanges like Binance, Coinbase, Bittrex, LocalBitcoins, & more.
For Free Live Demo visit @



Which is the best cryptocurrency exchange?

I would like to know the best cryptocurrency exchanges.Any suggestions? – Exchanger monitoring – Electronic currency exchangers

spacer.png "class =" ipsImage "data-ratio =" 25.16 "height =" 200 "style =" height: auto; "width =" 795 "data-src =" /1551589568/57ef5784/25613443.jpg "src =" spacer.png "/></p>
<span lang=If you are exchanging electronic currencies, money – our exchange offices is for you! Here you will receive reliable information on the most profitable exchangers and exchange rates from

electronic currencies and cryptocurrencies

By choosing the best exchange rate, you can trust the reliability of the exchangers included in our catalog. All the exchangers listed on this site have great confidence and sufficient reserves.

On the page monitoring of exchangers blacklist of exchangers electronic money, cryptocurrencies, scam exchangers, scam exchangers, phishing phishing exchange points, scammers, fraudulent payment systems, payment aggregators, electronic money doublers, financial pyramids. You can check the availability of the site in the list to find out how much you can trust it.

Almost always, our customers benefit from additional discounts and bonuses in exchange offices, which makes currency exchange thanks to us even more profitable.