var macro;
var pesan, jLoss=0, jWin=0, profit, jHasil=0, amount;
var panjang, buffpo;
var direction = Number(prompt("Direction :\nUP : 1\nDOWN : 2\n",1));
var duration= Number(prompt("Duration (in minutes) : ",2));
var modalawal = Number(prompt("Amount / Stake : ",0.5));
amount=modalawal;
var haisl1, hasil2, hasil3;
for (i=1; ;i++) {
macro = "CODE:";
macro+= "TAG POS=1 TYPE=SELECT FORM=ID:websocket_form ATTR=ID:duration_units CONTENT=%m\n";
macro+= "TAG POS=1 TYPE=INPUT:NUMBER FORM=ID:websocket_form ATTR=ID:duration_amount CONTENT="+duration+"\n";
macro+= "TAG POS=1 TYPE=SELECT FORM=ID:websocket_form ATTR=ID:amount_type CONTENT=%stake\n";
macro+= "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:websocket_form ATTR=ID:amount CONTENT="+amount+"\n";
macro+= "WAIT SECONDS=2\n";
if (direction == 1) {
macro+= "TAG POS=1 TYPE=BUTTON ATTR=ID:purchase_button_top\n";
macro+= "WAIT SECONDS=2\n";
} else {
macro+= "TAG POS=1 TYPE=BUTTON ATTR=ID:purchase_button_bottom\n";
macro+= "WAIT SECONDS=2\n";
}
iimPlay(macro);
pesan = ">> RF Minutes FREE <<\n";
pesan += "Win : " + jWin + "x || Loss : " + jLoss + "x\n";
pesan += "Result : $" + jHasil.toFixed(2);
iimDisplay(pesan);
macro = "CODE:";
macro+= "TAG POS=1 TYPE=BUTTON ATTR=ID:contract_purchase_button\n";
macro+= "WAIT SECONDS="+ (duration * 60) +"\n";
iimPlay(macro);
macro = "CODE:";
macro += "TAG POS=1 TYPE=TD ATTR=ID:trade_details_profit_loss extract=txt\n";
macro+= "WAIT SECONDS=1\n";
iimPlay(macro);
hasil = iimGetLastExtract(1);
j = 0;
panjang = 0;
while (hasil[j] != "(")
{
panjang++;
j++;
}
buff="";
for(k=4;k<panjang;k++)
{
buff += hasil[k];
}
profit=Number(buff);
jHasil += profit;
if (profit > 0)
{
jWin++;
amount=modalawal;
}
else
{
jLoss++;
amount=amount*2.1;
}
pesan = ">> RF Minutes FREE <<\n";
pesan += "Win : " + jWin + "x || Loss : " + jLoss + "x\n";
pesan += "Result : $" + jHasil.toFixed(2);
iimDisplay(pesan);
if (jHasil > 0) {break;}
//macro = "CODE:";
//macro+= "TAG POS=2 TYPE=A ATTR=TXT:x\n";
//iimPlay(macro);
}