nodejs / nodejs/nan

Under 8 bott

Open
#1,020 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
3.4k
Forks
531
Avg merge
21m
Merged PRs (30d)
1

Description

// ===============================
// DERIV UNDER 8 SMART BOT
// Optimized Beginner Strategy
// ===============================

// SETTINGS
const SYMBOL = 'R_100';
const STAKE = 1;
const MAX_LOSSES = 2;

// Internal Variables
let losses = 0;
let cooldown = false;

// MAIN LOOP
const runBot = async () => {

while (true) {

// Get latest tick
let tick = await Bot.getTicks(SYMBOL);

let quote = tick.quote.toString();
let digit = parseInt(quote.slice(-1));

console.log("Last Digit:", digit);

// ==================================
// SMART ENTRY CONDITIONS
// ==================================

// Only trade after 8 or 9
// because probability favors UNDER 8 next

if ((digit === 8 || digit === 9) && !cooldown) {

  console.log("GOOD SIGNAL DETECTED");

  // Buy UNDER 8
  let contract = await Bot.buy({

    contract_type: 'DIGITUNDER',
    symbol: SYMBOL,
    duration: 1,
    duration_unit: 't',
    barrier: '8',
    amount: STAKE

  });

  console.log("UNDER 8 TRADE PLACED");

  // Wait for result
  let result = await contract.wait();

  // ========================
  // WIN MANAGEMENT
  // ========================

  if (result.profit > 0) {

    console.log("WIN");

    losses = 0;

  } else {

    console.log("LOSS");

    losses++;

    // ========================
    // LOSS PROTECTION
    // ========================

    // Pause after consecutive losses
    if (losses >= MAX_LOSSES) {

      console.log("Cooldown Started");

      cooldown = true;

      // Wait 20 seconds
      await Bot.sleep(20000);

      cooldown = false;

      losses = 0;

      console.log("Cooldown Ended");
    }
  }

  // Small delay between trades
  await Bot.sleep(1500);
}

}
};

// START BOT
runBot();

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue contains a JavaScript trading-bot script but does not identify a nan file, test, entry point, or requested change. First verify whether the report is relevant to this repository; no completion criteria or repository-specific validation are provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
5/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.