Skip to content

Issue using getXMinuteMA as custom indicator #106

Open
@rabinage

Description

When using a custom indicator with getXMinuteMA() I get some weird results.

// Config
{
    "data": [
        {
            "exchanges": [
                "Poloniex"
            ],
            "tradeTotalBtc": 1,
            "warmUpMin": 0,
            "strategies": {
                "SMATest": {
                    "interval": 5,
                    "pair": "USDC_USDT",
                    "candleSize": 5
                }
            }
        }
    ]
}

// Indicator
import { TechnicalStrategy, TechnicalStrategyAction } from "./TechnicalStrategy";

export default class SMATest extends TechnicalStrategy {
    constructor(options) {
        super(options)
        this.addIndicator("sma40", "SMA", { short: 40, long: 41 } as TechnicalStrategyAction)
    }

    protected checkIndicators() {
        this.computeCustomIndicator("custom-sma40", this.getXMinuteMA(5, 40, 0)).then((data) => {
            const sma = this.indicators.get("sma40").getShortLineValue()

            if (data !== -1) {
                const custom_sma = this.customIndicators.get("custom-sma40")
                this.plotData.plotMark({
                    "custom_sma": custom_sma
                })
            }
            this.plotData.plotMark({
                "sma": sma,
            })
        })
    }
}

wb_custom_sma

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions