Skip to content

this is a bug #8

@beaquant

Description

@beaquant

Hello sdcoffey,
Long time to see you here, I hope you're ok.
In this function, it's not satisfied to use close price divide CostBasis

func (slr stopLossRule) IsSatisfied(index int, record *TradingRecord) bool {
	if !record.CurrentPosition().IsOpen() {
		return false
	}

	openPrice := record.CurrentPosition().CostBasis()
	loss := slr.Indicator.Calculate(index).Div(openPrice).Sub(big.ONE)
	return loss.LTE(slr.tolerance)
}

openPrice := record.CurrentPosition().CostBasis()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions