ewoDgtrd

package
v1.60.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: AGPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const ID = "ewo_dgtrd"

Variables

This section is empty.

Functions

This section is empty.

Types

type CCISTOCH added in v1.33.0

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

Refer: https://tw.tradingview.com/script/XZyG5SOx-CCI-Stochastic-and-a-quick-lesson-on-Scalping-Trading-Systems/

func NewCCISTOCH added in v1.33.0

func NewCCISTOCH(i types.Interval, filterHigh, filterLow float64) *CCISTOCH

func (*CCISTOCH) BuySignal added in v1.33.0

func (inc *CCISTOCH) BuySignal() bool

func (*CCISTOCH) SellSignal added in v1.33.0

func (inc *CCISTOCH) SellSignal() bool

func (*CCISTOCH) Update added in v1.33.0

func (inc *CCISTOCH) Update(cloze float64)

type HeikinAshi

type HeikinAshi struct {
	Close  *types.Queue
	Open   *types.Queue
	High   *types.Queue
	Low    *types.Queue
	Volume *types.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 Strategy

type Strategy struct {
	// Embedded components
	// ===================
	*bbgo.Environment
	bbgo.StrategyController

	// Market of the symbol
	Market types.Market

	// Session is the trading session of this strategy
	Session *bbgo.ExchangeSession

	// Persistence fields
	// ====================
	// Position
	Position *types.Position `json:"position,omitempty" persistence:"position"`

	// ProfitStats
	ProfitStats *types.ProfitStats `json:"profitStats,omitempty" persistence:"profit_stats"`

	// Settings fields
	// =========================
	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 SL on short
	DisableLongStop     bool             `json:"disableLongStop"`     // disable SL on long
	FilterHigh          float64          `json:"cciStochFilterHigh"`  // high filter for CCI Stochastic indicator
	FilterLow           float64          `json:"cciStochFilterLow"`   // low filter for CCI Stochastic indicator
	EwoChangeFilterHigh float64          `json:"ewoChangeFilterHigh"` // high filter for ewo histogram
	EwoChangeFilterLow  float64          `json:"ewoChangeFilterLow"`  // low filter for ewo histogram

	Record bool `json:"record"` // print record messages on position exit point

	KLineStartTime types.Time
	KLineEndTime   types.Time
	// contains filtered or unexported fields
}

func (*Strategy) CancelAll added in v1.33.0

func (s *Strategy) CancelAll(ctx context.Context)

func (*Strategy) ClosePosition added in v1.33.0

func (s *Strategy) ClosePosition(ctx context.Context) (*types.Order, bool)

ClosePosition(context.Context) -> (closeOrder *types.Order, ok bool) this will decorate the generated order from NewMarketCloseOrder add do necessary checks if available quantity is zero, will return (nil, true) if any of the checks failed, will return (nil, false) otherwise, return the created close order and true

func (*Strategy) GetLastPrice added in v1.33.0

func (s *Strategy) GetLastPrice() fixedpoint.Value

func (*Strategy) ID

func (s *Strategy) ID() string

func (*Strategy) Initialize

func (s *Strategy) Initialize() error

func (*Strategy) InstanceID added in v1.33.0

func (s *Strategy) InstanceID() string

func (*Strategy) PlaceBuyOrder added in v1.33.0

func (s *Strategy) PlaceBuyOrder(ctx context.Context, price fixedpoint.Value) (*types.Order, *types.Order)

func (*Strategy) PlaceSellOrder added in v1.33.0

func (s *Strategy) PlaceSellOrder(ctx context.Context, price fixedpoint.Value) (*types.Order, *types.Order)

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 by atr (lastprice < buyprice - atr) || (lastprice > sellprice + atr) - TP by detecting if there's a ewo pivotHigh(1,1) -> close long, or pivotLow(1,1) -> close short - TP by ma34 +- atr * 2 - TP by (lastprice < peak price - atr) || (lastprice > bottom price + 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 on previous K bar and no crossunder on latest K bar)
  • sell signal on (crossunder on previous K bar and no crossunder on latest K bar)

- and filtered by the following rules:

  • buy: buy signal ON, kline Close > Open, Close > ma5, Close > ma34, CCI Stochastic Buy signal
  • sell: sell signal ON, kline Close < Open, Close < ma5, Close < ma34, CCI Stochastic Sell signal

- or entry when ma34 +- atr * 3 gets touched - entry price: latestPrice +- atr / 2 (short,long), close at market price Cancel non-fully filled orders on new signal (either in same direction or not)

ps: kline might refer to heikinashi or normal ohlc

func (*Strategy) SetupIndicators

func (s *Strategy) SetupIndicators(store *bbgo.MarketDataStore)

Setup the Indicators going to be used

func (*Strategy) Subscribe

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

type VWEMA

type VWEMA struct {
	PV types.UpdatableSeries
	V  types.UpdatableSeries
}

func (*VWEMA) Index

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

func (*VWEMA) Last

func (inc *VWEMA) Last(i int) 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