示例#1
0
        public void ShowGraph()
        {
            GraphViewModel ChartVM = new GraphViewModel(CandidateVotes, PartyVotes, InvalidVotes);
            GraphBar       view    = new GraphBar(ChartVM);

            view.Show();
        }
示例#2
0
 void ZeroGraph()
 {
     for (int i = 0; i < graphBars.Length; i++)
     {
         GraphBar g = graphBars[i];
         g.TweenToScale(0.1f);
     }
 }
    private void set_graph_bar_data(GameObject new_bar, int current_year, int people_alive)
    {
        GraphBar graph_bar = new_bar.GetComponent <GraphBar>();

        graph_bar.SetBarColor(m_graph_colors[bar_color_index]);
        graph_bar.SetIndicatorObject(this, m_indicator);
        graph_bar.SetBarData(current_year, people_alive);
    }
    private IEnumerator set_initial_bar()
    {
        //Goes through all graph bars and finds the first object with a population == mostPeopleAlive;
        GraphBar bar = m_graph_bars.Where(obj => obj.GetComponent <GraphBar>().population == GraphStatistics.mostPeopleAliveAtOnce).ToList()[0].GetComponent <GraphBar>();

        yield return(new WaitForEndOfFrame());        //waiting for bars position to be set on canvas;

        bar.SetBarAsActive();
        yield break;
    }
    IEnumerator ShowGraphInnings(Dictionary <int, int> runsbyOvers)
    {
        iTween.MoveTo(GraphMan.gameObject, iTween.Hash("position", GraphPos.position, "easeType", iTween.EaseType.easeOutSine, "loopType", iTween.LoopType.none, "time", 1f));
        iTween.MoveTo(BotBar.gameObject, iTween.Hash("position", BotBarPos.position, "easeType", iTween.EaseType.easeOutSine, "loopType", iTween.LoopType.none, "time", 1f));

        yield return(new WaitForSeconds(1f));

        int initialBars = GraphBars.Count;

        totalScore = 0;

        TotalOversTxt.text = runsbyOvers.Count.ToString();
        int currOverScore = 0;

        for (int i = 0; i < runsbyOvers.Count; i++)
        {
            if (runsbyOvers.TryGetValue(i, out currOverScore))
            {
                if (initialBars == 0)
                {
                    GameObject bar = Instantiate(BarPrefab) as GameObject;
                    bar.transform.SetParent(BarsParent);
                    bar.transform.localScale    = Vector3.one;
                    bar.transform.localPosition = Vector3.zero;
                    GraphBar BarGB = bar.GetComponent <GraphBar>();
                    BarGB.ShowSelf(i, currOverScore);
                    GraphBars.Add(BarGB);
                }
                else
                {
                    GraphBars[i].ShowSelf(i, currOverScore);
                    initialBars--;
                }
                totalScore += currOverScore;
            }
            else
            {
                //ShowBar(i,0);
            }
            //yield return new WaitForSeconds(0.1f);
        }

        for (int j = 0; j < GraphBars.Count; j++)
        {
            GraphBars[j].PlayAnimation();
        }

        TotalScoreTxt.text = totalScore.ToString();
    }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        if (exhaling)
        {
            float realtimeSinceStartup = Time.realtimeSinceStartup;

            if (realtimeSinceStartup - startTime >= maxTime)
            {
                startTime = realtimeSinceStartup;
            }

            float    delta = realtimeSinceStartup - startTime;
            int      i     = (int)((delta / maxTime) * (dataPoints));
            GraphBar g     = graphBars[i];
            g.TweenToScale(FizzyoFramework.Instance.Device.Pressure() * 50.0f);
        }
    }
    void Awake()
    {
        var cam = Camera.main;

        var subcol = Color.white * 0.7f;

        subcol.a = 1f;

        _deltaBar = new GraphBar(cam, RenderMaterial)
        {
            Position = new Vector2(20f, 30f), MainColor = this.MainColor, SubColor = this.SubColor, OutlineColor = this.OutlineColor, OverflowColor = this.OverflowColor, RealValueColor = this.RealValueIndicatorColor
        };
        _smoothDeltaBar = new GraphBar(cam, RenderMaterial)
        {
            Position = new Vector2(20f, 70f), MainColor = this.MainColor, SubColor = this.SubColor, OutlineColor = this.OutlineColor, OverflowColor = this.OverflowColor, RealValueColor = this.RealValueIndicatorColor
        };
        _bar = new GraphBar(cam, RenderMaterial)
        {
            Position = new Vector2(20f, 110f), MainColor = this.MainColor, SubColor = this.SubColor, OutlineColor = this.OutlineColor, OverflowColor = this.OverflowColor, RealValueColor = this.RealValueIndicatorColor
        };
    }
        public Verdict GetStrategiesVerdict(
            GraphBar currentTicker,
            Iindicators taLibWrapper,
            transaction lastTransaction,
            OrderBook currentOrderBook,
            double currentHoardedSecurityAmount,
            double currentSpeculatedSecurityAmount,
            double feepercentage)
        {
            //Get the indicators
            var macd = taLibWrapper.Momentums
                       .MovingAverageConvergenceDivergence(
                unitType: Frequency.hour,
                historiesLength: (int)QuantityLimits.HISTORY_LENGTH,
                slowMaType: Core.MAType.Ema,
                fastMaType: Core.MAType.Sma,
                signalMaType: Core.MAType.Ema);

            var stoch = taLibWrapper.Momentums
                        .Stochastic(
                unitType: Frequency.hour,
                historiesLength: conditionWindowHours);

            //filter macd results to the past two days
            double[] filteredMacd    = NeutralizeDataBeyondTwoDays(macd.Series.macd, macd.NBElement);
            double[] filteredHistory = NeutralizeDataBeyondTwoDays(macd.Series.macdHistory, macd.NBElement);
            double[] filteredSignal  = NeutralizeDataBeyondTwoDays(macd.Series.macdSignal, macd.NBElement);
            macd.Series = (macd : filteredMacd, macdSignal : filteredSignal, macdHistory : filteredHistory);

            //get extra data required
            int equilibriumLine = 50;

            //define the trade conditions
            bool macdCrossedAboveSignal            = false;
            bool histogramCrossedAboveSignal       = false;
            bool stochasticKCrossedOverD           = false;
            bool macdConditionsOccuredBeforeStochs = false;

            for (int i = 0; i < stoch.Series.slowD.Count(); i++)
            {
                if (stoch.Series.slowK[i] > stoch.Series.slowD[i])
                {
                    stochasticKCrossedOverD = true;
                }
            }

            for (int i = 0; i < filteredSignal.Count(); i++)
            {
                if (filteredMacd[i] > filteredSignal[i])
                {
                    macdCrossedAboveSignal = true;
                }

                if (filteredHistory[i] > filteredSignal[i])
                {
                    histogramCrossedAboveSignal = true;
                }

                if (macdCrossedAboveSignal &&
                    histogramCrossedAboveSignal &&
                    stochasticKCrossedOverD == false)
                {
                    macdConditionsOccuredBeforeStochs = true;
                }
            }

            //make the call
            if (stochasticKCrossedOverD &&
                macdCrossedAboveSignal &&
                histogramCrossedAboveSignal &&
                macdConditionsOccuredBeforeStochs)

            {
                double sellablAmount = DetermineSafeExposureAmount(currentOrderBook, MarketAction.BUY, currentHoardedSecurityAmount, currentSpeculatedSecurityAmount);
                return(new Verdict(MarketAction.BUY, sellablAmount));
            }

            else if (currentHoardedSecurityAmount != 0)
            {
                double sellablAmount = DetermineSafeExposureAmount(currentOrderBook, MarketAction.SELL, currentHoardedSecurityAmount, currentSpeculatedSecurityAmount);
                return(new Verdict(MarketAction.BUY, sellablAmount));
            }

            else
            {
                return(new Verdict(MarketAction.HOLD, 0));
            }
        }