Welcome to the world of automated trading strategies! This guide is designed to help you understand every single small thing in Buddytrading script that you’ll encounter when creating or editing strategies. Even if you’ve never coded before, this guide will break everything down into simple, easy-to-understand concepts.
JavaScript is a programming language used to make websites interactive and build applications. In trading strategies, it’s used to define rules and logic for buying, selling, and managing trades.
Variables are like containers that store information. You can store numbers, text, or other data in them.
let price = 100; // Stores the number 100
let asset = "BTC"; // Stores the text "BTC"
let
: This keyword is used to declare a variable. It means "let’s create a container called price
and put the value 100
in it."=
: This is the assignment operator. It assigns the value on the right (100
) to the variable on the left (price
).;
: A semicolon marks the end of a statement. It’s like a period at the end of a sentence.Constants are like variables, but their value cannot change once set.
const pi = 3.14; // Stores the number 3.14
const
: This keyword is used to declare a constant. It means "create a container called pi
and put the value 3.14
in it, and never change it."Functions are blocks of code that perform a specific task. They can take inputs (called arguments) and return outputs.