-
Notifications
You must be signed in to change notification settings - Fork 0
/
index1.html
291 lines (236 loc) · 7.46 KB
/
index1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<html>
<head>
<title>Simulador de Day Trade - FOREX - Dolar </title>
<meta charset="UTF-8">
<meta name="description" content="Simulador de Day Trade grátis">
<meta name="keywords" content="DayTrade, Dolar, Scalper, WDOL, Nelogica, Profitchart">
<meta name="author" content="@trader.choice">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
#chartrading {
width:650px;
}
input[type="number"] {
width:50px;
}
.button {
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 18px;
cursor: pointer;
-webkit-transition-duration: 0.4s; /* Safari */
transition-duration: 0.4s;
opacity:1;
}
.saldo {
text-align:center;
}
.result_fechado {
text-align:center;
}
button[disabled]:active, button[disabled],
input[type="button"][disabled]:active,
input[type="button"][disabled],
input[type="submit"][disabled]:active,
input[type="submit"][disabled] ,
button[disabled]:hover,
input[type="button"][disabled]:hover,
input[type="submit"][disabled]:hover
{
border: 0px outset ButtonFace;
color: GrayText;
cursor: inherit;
background-color: #ddd;
background: #ddd;
}
.result_value {background-color: #0099FF; }
.button1 {background-color: #0099FF; } /* Azul */
.button2 {background-color: #f44336;} /* Vermelho */
.button3 {background-color: #00cccc;}
.button1:hover {box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); }
.button2:hover { box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); }
.button3:hover { box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); }
</style>
</head>
<body>
<h4>Simulador de Day Trade - FOREX USD/BRL - Funcionamento:9h as 18h UTC-3</h4>
<div>
<iframe height="480" width="650" frameBorder="0" src="https://ssltvc.forexprostools.com/?pair_ID=2103&height=480&width=650&interval=300&plotStyle=candles&domain_ID=30&lang_ID=12&timezone_ID=10"></iframe>
</div>
<div id="chartrading">
<div align="center">
<button class="button button1" id="button1" onclick="fcompra()">Comprar</button>
<button class="button button2" id="button2" onclick="fvenda()">Vender</button>
<button class="button button3" onclick="fzerar()" style="display: none;">Zerar</button>
</div>
<br>
<div align="left">
<label for="quantity">Micro Lotes (x1000):</label>
<input type="number" id="quantity" name="quantity" min="1" max="100000" value="10";>
<h4 id="posicao">Posição: Zerado </h4>
</div>
<table style="width:100%">
<tr>
<td>Resultado aberto:</td>
<td id="saldo">R$ 0,00</td>
</tr>
<tr>
<td>Resultado fechado:</td>
<td id="result_fechado" >R$ 0,00</td>
</tr>
</table>
<div>
<h5 id="nr_nego"></h5>
<h5 id="performance"></h5>
</div>
</div>
<script>
var ask_compra = document.getElementById("button1");
var bid_venda = document.getElementById("button2");
var posicao = document.getElementById("posicao");
var saldo=document.getElementById("saldo");
var result_fechado1=document.getElementById("result_fechado");
var ask;
var bid;
var getask;
var getbid;
var compra;
var venda;
var zerar;
var resultado;
var result;
var getresult=0;
var quantidade ;
var getquant;
var saldo_final;
var valor_pip;
var negocios=document.getElementById("nr_nego");
var performance=document.getElementById("performance");
var nr_negocios=0
var performance_vencedora=0;
var performance_perdedora=0;
var valor_perdedora;
var valor_vencedora;
var performance_zerada=0;
setInterval(function(){
fetch(`https://economia.awesomeapi.com.br/all/USD-BRL`)
.then(response => response.json())
.then(data => { ask_compra.innerHTML="Comprar (ask)<br>"+data['USD']['ask']
bid_venda.innerHTML="Vender (bid)<br>"+data['USD']['bid']
ask=parseFloat(data['USD']['ask'])
bid=parseFloat(data['USD']['bid'])
valor_pip=(0,0001/bid).toFixed(2);
if (compra) { var resultado=bid-getask;
saldo_final=resultado*valor_pip*1000*getquant;
saldo_final=(saldo_final*bid).toFixed(2);
saldo.innerHTML="R$ "+saldo_final;
if (saldo_final < 0)
{
document.getElementById("saldo").style.backgroundColor = 'red';
document.getElementById("saldo").style.color = 'white';
} else if (saldo_final > 0) {
document.getElementById("saldo").style.backgroundColor = 'green';
document.getElementById("saldo").style.color = 'white';
} else {
document.getElementById("saldo").style.backgroundColor = '#FFFFFFFF';
document.getElementById("saldo").style.color = 'black';
}
}
if (venda) { var resultado=getbid-ask;
saldo_final=resultado*valor_pip*1000*getquant;
saldo_final=(saldo_final*bid).toFixed(2);
saldo.innerHTML="R$ "+saldo_final;
if (saldo_final < 0) {
document.getElementById("saldo").style.backgroundColor = 'red';
document.getElementById("saldo").style.color = 'white';
} else if (saldo_final > 0) {
document.getElementById("saldo").style.backgroundColor = 'green';
document.getElementById("saldo").style.color = 'white';
} else {
document.getElementById("saldo").style.backgroundColor = '#FFFFFFFF';
document.getElementById("saldo").style.color = 'black';
}
}
})
}, 10);
function fcompra() {
if (venda) {
fzerar();
} else {
getquant=document.getElementById("quantity").value;
compra=true;
venda=false;
getask=ask;
ask_compra.disabled = true;
// bid_venda.disabled = true;
posicao.innerHTML="Posição: "+getquant+" Micro Lote(s),"+" Comprado a "+getask;
}
}
function fvenda() {
if (compra) {
fzerar();
} else {
getquant=document.getElementById("quantity").value;
compra=false;
venda=true;
getbid=bid;
// ask_compra.disabled = true;
bid_venda.disabled = true;
posicao.innerHTML="Posição: "+getquant+" Micro Lote(s),"+" Vendido a "+getbid;
}
}
function fzerar() {
var fzerar=true;
nr_negocios+=1;
if (saldo_final > 0) {
performance_vencedora+=1;
valor_vencedora=parseFloat(performance_vencedora/nr_negocios*100).toFixed(2);
valor_perdedora=(100-valor_vencedora).toFixed(2);
} else if (saldo_final < 0) {
performance_perdedora+=1;
valor_perdedora=parseFloat(performance_perdedora/nr_negocios*100).toFixed(2);
valor_vencedora=(100-valor_perdedora).toFixed(2);
} else {
performance_zerada+=1;
}
negocios.innerHTML="Negociações: "+nr_negocios;
performance.innerHTML="Vencedoras: "+performance_vencedora+" ("+valor_vencedora+"%)"+", Perdedoras: "+performance_perdedora+" ("+valor_perdedora+"%)";
getresult=parseFloat(getresult)+parseFloat(saldo_final);
result_fechado1.innerHTML="R$ "+getresult.toFixed(2);//+",00";
ask_compra.disabled = false;
bid_venda.disabled = false;///}
saldo.innerHTML="R$ 0,00";
if (getresult < 0) {
document.getElementById("result_fechado").style.backgroundColor = 'red';
document.getElementById("result_fechado").style.color = 'white';
} else if (getresult > 0) {
document.getElementById("result_fechado").style.backgroundColor = 'green';
document.getElementById("result_fechado").style.color = 'white';
} else {
document.getElementById("result_fechado").style.backgroundColor = '#FFFFFFFF';
document.getElementById("result_fechado").style.color = 'black';
}
saldo_final=0;
posicao.innerHTML="Posição: Zerado";
document.getElementById("saldo").style.backgroundColor = '#FFFFFFFF';
document.getElementById("saldo").style.color = '#000000';
compra=false;
venda=false;
}
</script>
<script>
</script>
</body>
</html>