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); }
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); }
public float CalcStopCandle(ativos.Candle candle) { if (stopCalc == null) { return(stopInicial); } float v = candle.GetValor(stopCalc); v = CalcValorStop(v, sentido, tradeSystem.stopGapPerc); return(v); }