Code Monkey home page Code Monkey logo

Comments (4)

karlwancl avatar karlwancl commented on August 15, 2024

If you're retrieving the signal of the last candle, you should set the second parameter of the indexedcandle to candles.count()-1 instead of 1

from trady.

mgocean avatar mgocean commented on August 15, 2024

Thanks for the fast response I think the following test methods mislead me about the parameter to be set as "1" . But still "candles.count()-1" doesn't catch the "if (indexedCandle.IsMacdBullishCross(x, y, z) == true)" condition. I will be debugging If I find anything I will share but If you have any root cause analysis result please share.
Thank you.

[TestMethod]
        public async Task TestIsBullish()
        {
            var candles = await ImportCandlesAsync();
            var indexedCandle = new IndexedCandle(candles, 1);
            var result = indexedCandle.IsBullish();
            Assert.IsFalse(result);
        }

        [TestMethod]
        public async Task TestIsBearish()
        {
            var candles = await ImportCandlesAsync();
            var indexedCandle = new IndexedCandle(candles, 1);
            var result = indexedCandle.IsBearish();
            Assert.IsTrue(result);
}

from trady.

mgocean avatar mgocean commented on August 15, 2024

Hi again, I found the problematic part
public static bool IsTrue(this (AnTick, AnTick, AnTick) obj, Func<AnTick, AnTick, AnTick, bool> predicate) { Predicate<AnTick> isValid = t => t != null && t.Tick != null && t.Tick.HasValue; return isValid(obj.Item1) && isValid(obj.Item2) && isValid(obj.Item3) && predicate(obj.Item1, obj.Item2, obj.Item3); }
always returns false for the following calls
`public static bool IsMacdBullishCross(this IIndexedOhlcv ic, int emaPeriodCount1, int emaPeriodCount2, int demPeriodCount)
=> ic.Get(emaPeriodCount1, emaPeriodCount2, demPeriodCount).ComputeNeighbour(ic.Index)
.IsTrue((prev, current, _) => prev.Tick.IsNegative() && current.Tick.IsPositive());

`

public static bool IsEmaBullishCross(this IIndexedOhlcv ic, int periodCount1, int periodCount2) => ic.Get<ExponentialMovingAverageOscillator>(periodCount1, periodCount2).ComputeNeighbour(ic.Index) .IsTrue((prev, current, _) => prev.Tick.IsNegative() && current.Tick.IsPositive());
and for all similar calls isValid(obj.Item3) returns false.

from trady.

karlwancl avatar karlwancl commented on August 15, 2024

Related to #53, this issue is closed.

from trady.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.