Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
10 views5 pages

Robotmagic2 1 HTML

The document describes an HTML page for 'Robotmagic 2.1', an automated trading bot that connects to the Deriv platform using WebSockets. Users can input their trading token to start the bot, which analyzes market ticks and makes trades based on predefined conditions. The bot tracks balance, profits, and losses, and will stop trading when a profit goal or loss limit is reached.

Uploaded by

kxb2gkwv9f
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views5 pages

Robotmagic2 1 HTML

The document describes an HTML page for 'Robotmagic 2.1', an automated trading bot that connects to the Deriv platform using WebSockets. Users can input their trading token to start the bot, which analyzes market ticks and makes trades based on predefined conditions. The bot tracks balance, profits, and losses, and will stop trading when a profit goal or loss limit is reached.

Uploaded by

kxb2gkwv9f
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

<meta name='viewport' content='width=device-width, initial-scale=1'/><!

DOCTYPE
html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Robotmagic 2.1 - Automático</title>
<style>
body { background: #111; color: #eee; font-family: monospace; padding: 20px; }
h1 { color: #00ffcc; }
input, button {
padding: 10px;
margin: 5px 0;
width: 300px;
border: 1px solid #00ffcc;
background: #222;
color: #00ffcc;
}
button { cursor: pointer; font-weight: bold; }
#log {
background: #000;
border: 1px solid #00ffcc;
padding: 15px;
margin-top: 10px;
height: 300px;
overflow-y: scroll;
}
</style>
</head>
<body>
<h1>🤖 Robotmagic 2.1 - Operação Automática</h1>
<p>Token da Deriv (real ou demo):</p>
<input id="token" placeholder="Cole seu token aqui..." />
<button onclick="startBot()">Iniciar Robô</button>
<div id="log">Aguardando conexão...</div>

<script>
let ws, token, balance = 0, lucro = 0, perda = 0, contratoAtivo = "R_100";
let valorEntrada = 0.5, metaLucro = 1.0, limitePerda = 2.0;
let emOperacao = false;

function log(msg) {
const el = document.getElementById("log");
el.innerHTML += "<br>" + msg;
el.scrollTop = el.scrollHeight;
}

function startBot() {
token = document.getElementById("token").value.trim();
if (!token) return alert("Insira seu token.");
ws = new WebSocket("wss://ws.derivws.com/websockets/v3?app_id=1089");
ws.onopen = () => {
ws.send(JSON.stringify({ authorize: token }));
log("🔐 Conectando...");
};
ws.onmessage = (msg) => {
const data = JSON.parse(msg.data);
if (data.msg_type === "authorize") {
log("✅ Conectado: " + data.authorize.loginid);
ws.send(JSON.stringify({ balance: 1 }));
ws.send(JSON.stringify({ ticks: contratoAtivo, subscribe: 1 }));
}
if (data.msg_type === "balance") {
balance = data.balance.balance;
log("💰 Saldo atual: $" + balance.toFixed(2));
}
if (data.msg_type === "tick" && !emOperacao) {
analisarTicks(data.tick.quote);
}
if (data.msg_type === "buy") {
const id = data.buy.buy_id;
log("🟢 Compra feita. ID: " + id);
monitorarResultado(id);
}
if (data.msg_type === "proposal_open_contract") {
if (data.proposal_open_contract.status === "sold") {
const lucroOuPreju = data.proposal_open_contract.profit;
if (lucroOuPreju >= 0) {
lucro += lucroOuPreju;
log("✅ Lucro: $" + lucroOuPreju.toFixed(2));
} else {
perda += Math.abs(lucroOuPreju);
log("❌ Perda: $" + Math.abs(lucroOuPreju).toFixed(2));
}
emOperacao = false;
if (lucro >= metaLucro) {
log("🎯 Meta de lucro atingida! Robô parado.");
ws.close();
} else if (perda >= limitePerda) {
log("🛑 Limite de perda atingido! Robô parado.");
ws.close();
}
}
}
};
}

let ultimosDigitos = [];


function analisarTicks(preco) {
const digito = parseInt(preco.toString().slice(-1));
ultimosDigitos.push(digito);
if (ultimosDigitos.length > 5) ultimosDigitos.shift();
const high = ultimosDigitos.filter(d => d >= 3).length;
const low = ultimosDigitos.filter(d => d <= 2).length;

if (high >= 4) {
comprar("DIGITOVER");
} else if (low >= 4) {
comprar("DIGITUNDER");
}
}

function comprar(tipo) {
emOperacao = true;
log("🧠 Sinal detectado: " + tipo + " | Enviando ordem...");
ws.send(JSON.stringify({
buy: 1,
price: valorEntrada,
parameters: {
amount: valorEntrada,
basis: "stake",
contract_type: tipo,
currency: "USD",
duration: 1,
duration_unit: "t",
symbol: contratoAtivo
}
}));
}

function monitorarResultado(id) {
setTimeout(() => {
ws.send(JSON.stringify({
proposal_open_contract: 1,
contract_id: id
}));
}, 5000);
}
</script>
</body>
</html>
<script><!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Robotmagic 2.1 - Automático</title>
<style>
body { background: #111; color: #eee; font-family: monospace; padding: 20px; }
h1 { color: #00ffcc; }
input, button {
padding: 10px;
margin: 5px 0;
width: 300px;
border: 1px solid #00ffcc;
background: #222;
color: #00ffcc;
}
button { cursor: pointer; font-weight: bold; }
#log {
background: #000;
border: 1px solid #00ffcc;
padding: 15px;
margin-top: 10px;
height: 300px;
overflow-y: scroll;
}
</style>
</head>
<body>
<h1>🤖 Robotmagic 2.1 - Operação Automática</h1>
<p>Token da Deriv (real ou demo):</p>
<input id="token" placeholder="Cole seu token aqui..." />
<button onclick="startBot()">Iniciar Robô</button>
<div id="log">Aguardando conexão...</div>

<script>
let ws, token, balance = 0, lucro = 0, perda = 0, contratoAtivo = "R_100";
let valorEntrada = 0.5, metaLucro = 1.0, limitePerda = 2.0;
let emOperacao = false;

function log(msg) {
const el = document.getElementById("log");
el.innerHTML += "<br>" + msg;
el.scrollTop = el.scrollHeight;
}

function startBot() {
token = document.getElementById("token").value.trim();
if (!token) return alert("Insira seu token.");
ws = new WebSocket("wss://ws.derivws.com/websockets/v3?app_id=1089");
ws.onopen = () => {
ws.send(JSON.stringify({ authorize: token }));
log("🔐 Conectando...");
};
ws.onmessage = (msg) => {
const data = JSON.parse(msg.data);
if (data.msg_type === "authorize") {
log("✅ Conectado: " + data.authorize.loginid);
ws.send(JSON.stringify({ balance: 1 }));
ws.send(JSON.stringify({ ticks: contratoAtivo, subscribe: 1 }));
}
if (data.msg_type === "balance") {
balance = data.balance.balance;
log("💰 Saldo atual: $" + balance.toFixed(2));
}
if (data.msg_type === "tick" && !emOperacao) {
analisarTicks(data.tick.quote);
}
if (data.msg_type === "buy") {
const id = data.buy.buy_id;
log("🟢 Compra feita. ID: " + id);
monitorarResultado(id);
}
if (data.msg_type === "proposal_open_contract") {
if (data.proposal_open_contract.status === "sold") {
const lucroOuPreju = data.proposal_open_contract.profit;
if (lucroOuPreju >= 0) {
lucro += lucroOuPreju;
log("✅ Lucro: $" + lucroOuPreju.toFixed(2));
} else {
perda += Math.abs(lucroOuPreju);
log("❌ Perda: $" + Math.abs(lucroOuPreju).toFixed(2));
}
emOperacao = false;
if (lucro >= metaLucro) {
log("🎯 Meta de lucro atingida! Robô parado.");
ws.close();
} else if (perda >= limitePerda) {
log("🛑 Limite de perda atingido! Robô parado.");
ws.close();
}
}
}
};
}

let ultimosDigitos = [];


function analisarTicks(preco) {
const digito = parseInt(preco.toString().slice(-1));
ultimosDigitos.push(digito);
if (ultimosDigitos.length > 5) ultimosDigitos.shift();
const high = ultimosDigitos.filter(d => d >= 3).length;
const low = ultimosDigitos.filter(d => d <= 2).length;

if (high >= 4) {
comprar("DIGITOVER");
} else if (low >= 4) {
comprar("DIGITUNDER");
}
}

function comprar(tipo) {
emOperacao = true;
log("🧠 Sinal detectado: " + tipo + " | Enviando ordem...");
ws.send(JSON.stringify({
buy: 1,
price: valorEntrada,
parameters: {
amount: valorEntrada,
basis: "stake",
contract_type: tipo,
currency: "USD",
duration: 1,
duration_unit: "t",
symbol: contratoAtivo
}
}));
}

function monitorarResultado(id) {
setTimeout(() => {
ws.send(JSON.stringify({
proposal_open_contract: 1,
contract_id: id
}));
}, 5000);
}
</script>
</body>
</html>
</script>

You might also like