Exemple #1
0
        public float CalcStop(ativos.Candle candle)
        {
            if (stopCalc == null)
            {
                return(stopInicial);
            }
            float v = CalcStopCandle(candle);

            //	System.out.println("StopInicial: "+stopInicial+" stopMovel:"+v+" "+(v>stopInicial));
            //Caso o valor da formula seja maior que o stopInicial então retorna o valor
            if (sentido > 0)
            {
                if (v > stopAtual)
                {
                    stopAtual = v;
                }
            }
            else
            {
                if (v < stopAtual)
                {
                    stopAtual = v;
                }
            }

            return(stopAtual);
        }
Exemple #2
0
        public bool VerificaCondicao(ativos.Candle candle, TradeSystem ts)
        {
            bool ret       = true;
            bool firstLoop = true;

            foreach (ICondicao cond in condicoes)
            {
                bool b = cond.VerificaCondicao(candle, ts);
                if (firstLoop)
                {
                    ret       = b;
                    firstLoop = false;
                }
                if (nodeType == ConstsComuns.BOOLEAN_TYPE.AND || nodeType == ConstsComuns.BOOLEAN_TYPE.NOT)
                {
                    ret = ret && b;
                }
                if (nodeType == ConstsComuns.BOOLEAN_TYPE.OR)
                {
                    ret = ret || b;
                }
            }

            if (nodeType == ConstsComuns.BOOLEAN_TYPE.NOT)
            {
                ret = !ret;
            }

            return(ret);
        }
Exemple #3
0
        public float CalcStopCandle(ativos.Candle candle)
        {
            if (stopCalc == null)
            {
                return(stopInicial);
            }
            float v = candle.GetValor(stopCalc);

            v = CalcValorStop(v, sentido, tradeSystem.stopGapPerc);
            return(v);
        }