ewoDgtrd

package
v1.31.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2022 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const ID = "ewo_dgtrd"

Variables

This section is empty.

Functions

This section is empty.

Types

type HeikinAshi

type HeikinAshi struct {
	Close  *Queue
	Open   *Queue
	High   *Queue
	Low    *Queue
	Volume *Queue
}

func NewHeikinAshi

func NewHeikinAshi(size int) *HeikinAshi

func (*HeikinAshi) Print

func (s *HeikinAshi) Print() string

func (*HeikinAshi) Update

func (inc *HeikinAshi) Update(kline types.KLine)

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func NewQueue

func NewQueue(size int) *Queue

func (*Queue) Index

func (inc *Queue) Index(i int) float64

func (*Queue) Last

func (inc *Queue) Last() float64

func (*Queue) Length

func (inc *Queue) Length() int

func (*Queue) Update

func (inc *Queue) Update(v float64)

type Strategy

type Strategy struct {
	Market           types.Market
	Session          *bbgo.ExchangeSession
	UseHeikinAshi    bool             `json:"useHeikinAshi"` // use heikinashi kline
	Stoploss         fixedpoint.Value `json:"stoploss"`
	Symbol           string           `json:"symbol"`
	Interval         types.Interval   `json:"interval"`
	UseEma           bool             `json:"useEma"`           // use exponential ma or not
	UseSma           bool             `json:"useSma"`           // if UseEma == false, use simple ma or not
	SignalWindow     int              `json:"sigWin"`           // signal window
	DisableShortStop bool             `json:"disableShortStop"` // disable TP/SL on short

	*bbgo.Graceful
	bbgo.SmartStops
	// contains filtered or unexported fields
}

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) Initialize

func (s *Strategy) Initialize() error

func (*Strategy) Run

func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, session *bbgo.ExchangeSession) error

Trading Rules: - buy / sell the whole asset - SL/TP by atr (buyprice - 2 * atr, sellprice + 2 * atr) - SL by s.Stoploss (Abs(price_diff / price) > s.Stoploss) - entry condition on ewo(Elliott wave oscillator) Crosses ewoSignal(ma on ewo, signalWindow)

  • buy signal on crossover
  • sell signal on crossunder

- and filtered by the following rules:

  • buy: prev buy signal ON and current sell signal OFF, kline Close > Open, Close > ma(Window=5), ewo > Mean(ewo, Window=5)
  • sell: prev buy signal OFF and current sell signal ON, kline Close < Open, Close < ma(Window=5), ewo < Mean(ewo, Window=5)

Cancel and repost on non-fully filed orders every 1m within Window=1

ps: kline might refer to heikinashi or normal ohlc

func (*Strategy) SetupIndicators

func (s *Strategy) SetupIndicators()

func (*Strategy) Subscribe

func (s *Strategy) Subscribe(session *bbgo.ExchangeSession)

type UpdatableSeries

type UpdatableSeries interface {
	types.Series
	Update(value float64)
}

type VWEMA

type VWEMA struct {
	PV UpdatableSeries
	V  UpdatableSeries
}

func (*VWEMA) Index

func (inc *VWEMA) Index(i int) float64

func (*VWEMA) Last

func (inc *VWEMA) Last() float64

func (*VWEMA) Length

func (inc *VWEMA) Length() int

func (*VWEMA) Update

func (inc *VWEMA) Update(kline types.KLine)

func (*VWEMA) UpdateVal

func (inc *VWEMA) UpdateVal(price float64, vol float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL