Subversion Repositories Integrator Subversion

Rev

Rev 779 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 779 Rev 794
Line 3... Line 3...
3
import java.math.BigDecimal;
3
import java.math.BigDecimal;
4
import java.math.RoundingMode;
4
import java.math.RoundingMode;
5
import java.util.ArrayList;
5
import java.util.ArrayList;
6
import java.util.List;
6
import java.util.List;
7
7
8
import br.com.ec.web.util.TipoOperacao;
-
 
9
import br.com.kronus.core.PadraoGatilho;
8
import br.com.kronus.core.PadraoGatilho;
10
import br.com.sl.domain.dto.robo.SinalTradeGatilho3;
9
import br.com.sl.domain.dto.robo.SinalTradeGatilho3;
11
import br.com.sl.domain.model.Candle;
10
import br.com.sl.domain.model.Candle;
12
import br.com.sl.domain.model.tipos.TipoSinal;
11
import br.com.sl.domain.model.tipos.TipoSinal;
13
import br.com.sl.domain.util.BigDecimalUtils;
12
import br.com.sl.domain.util.BigDecimalUtils;
Line 37... Line 36...
37
           
36
           
38
            // só interessa padrão completo até G3
37
            // só interessa padrão completo até G3
39
            if (p.getTipoPadrao() != PadraoGatilho.TipoPadrao.COMPLETO_G3) {
38
            if (p.getTipoPadrao() != PadraoGatilho.TipoPadrao.COMPLETO_G3) {
40
                continue;
39
                continue;
41
            }
40
            }
42
-
 
-
 
41
           
43
            Candle ref = p.getReferencia();
42
            Candle ref = p.getReferencia();
44
            Candle g1  = p.getGatilho1();
43
            Candle g1  = p.getGatilho1();
45
            Candle g2  = p.getGatilho2();
44
            Candle g2  = p.getGatilho2();
46
            Candle g3  = p.getGatilho3();
45
            Candle g3  = p.getGatilho3();
47
46
Line 81... Line 80...
81
        // Garantia mínima de geometria: topo > fundo
80
        // Garantia mínima de geometria: topo > fundo
82
        if (BigDecimalUtils.ehMenorOuIgualQue(topoG2, fundoG3)) {
81
        if (BigDecimalUtils.ehMenorOuIgualQue(topoG2, fundoG3)) {
83
            return null;
82
            return null;
84
        }
83
        }
85
       
84
       
86
        if (g3.getContadorCandle().equals(524)) {
-
 
87
                System.out.println("524");
-
 
88
        }
-
 
89
-
 
90
        // Orientação: 0% = topo (G3), 100% = fundo (G2)
85
        // Orientação: 0% = topo (G3), 100% = fundo (G2)
91
        BigDecimal base0   = topoG2;
86
        BigDecimal base0   = topoG2;
92
        BigDecimal base100 = fundoG3;
87
        BigDecimal base100 = fundoG3;
93
88
94
        BigDecimal entrada1 = nivelFibo(base0, base100, 50.0);    // 50%
89
        BigDecimal entrada1 = nivelFibo(base0, base100, 50.0);    // 50%
Line 101... Line 96...
101
        BigDecimal stopAlt = fundoG3.add(
96
        BigDecimal stopAlt = fundoG3.add(
102
                        topoG2.subtract(fundoG3).multiply(BigDecimal.valueOf(0.25))
97
                        topoG2.subtract(fundoG3).multiply(BigDecimal.valueOf(0.25))
103
        );
98
        );
104
99
105
        SinalTradeGatilho3 s = new SinalTradeGatilho3();
100
        SinalTradeGatilho3 s = new SinalTradeGatilho3();
-
 
101
        s.setIdAtivo(padrao.getIdAtivo());
106
        s.setPadrao(padrao);
102
        s.setPadrao(padrao);
107
        s.setReferencia(ref);
103
        s.setReferencia(ref);
108
        s.setGatilho1(g1);
104
        s.setGatilho1(g1);
109
        s.setGatilho2(g2);
105
        s.setGatilho2(g2);
110
        s.setGatilho3(g3);
106
        s.setGatilho3(g3);
Line 152... Line 148...
152
        BigDecimal stopAlt = topoG3.subtract(
148
        BigDecimal stopAlt = topoG3.subtract(
153
                        topoG3.subtract(fundoG2).multiply(BigDecimal.valueOf(0.25))
149
                        topoG3.subtract(fundoG2).multiply(BigDecimal.valueOf(0.25))
154
        );
150
        );
155
151
156
        SinalTradeGatilho3 s = new SinalTradeGatilho3();
152
        SinalTradeGatilho3 s = new SinalTradeGatilho3();
-
 
153
        s.setIdAtivo(padrao.getIdAtivo());
157
        s.setPadrao(padrao);
154
        s.setPadrao(padrao);
158
        s.setReferencia(ref);
155
        s.setReferencia(ref);
159
        s.setGatilho1(g1);
156
        s.setGatilho1(g1);
160
        s.setGatilho2(g2);
157
        s.setGatilho2(g2);
161
        s.setGatilho3(g3);
158
        s.setGatilho3(g3);