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() |
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
techan/rule_stop.go
Line 24 in e00a032