# Introduction

Origami Tech is a low-code, non-custodial platform for automated crypto trading across multiple exchanges.&#x20;

Users can create and deploy strategies using visual templates or custom logic, manage multiple accounts and bots within projects, and control shared parameters through global variables.&#x20;

The platform provides real-time monitoring, historical data, and analytics for performance review, along with risk management tools like configurable limits and pre-trade checks.&#x20;

### **Unique Aspects**

* Low-code accessibility allows users to execute advanced strategies without programming skills.
* Unified workspace brings multiple accounts, strategies, and bots together in a single environment to simplify management of complex setups.
* Transparency ensures every action is traceable and all strategy logic remains visible for review.
* Real-time adaptation lets traders adjust strategies and parameters instantly in response to market conditions.

{% embed url="<https://www.youtube.com/watch?v=-_82f1pomEo>" %}

***

<p align="right"><a href="https://discord.com/invite/origamitech" class="button primary" data-icon="discord">Discord</a></p>


# Core Concepts

This section describes the main entities that make up the Origami Tech platform.

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> **Profile**

A profile is created automatically when you register on the platform. It contains your personal information, authentication data, and your referral link. You can manage security preferences, update your password, and turn on two-factor authentication.&#x20;

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> Account

An account is a connection between Origami Tech and a specific crypto exchange. It is established using the exchange’s API key and acts as the interface for all trading operations.

Accounts can be configured for spot or futures markets and may be reused across several projects or bots. They can be managed from the accounts page or within a selected project.

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> **Project**

A project is the main workspace unit. It combines exchange accounts and bots under a single structure. Projects are used to separate and organize your trading setup by strategy, exchange accounts, risk profile, or any other criteria.

Each project can contain multiple accounts and participants, each with defined roles (Admin, Editor, Viewer, and Analyst). All trading pairs and settings are stored within the project for consistent access across devices.

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> **Bot**

A bot is an automated trading instance that encapsulates the connection between a specific exchange account and a trading pair. Each bot operates according to predefined logic and executes trades on spot or futures markets.&#x20;

Bots can be created manually or from presets, edited at any time, and paused or removed when not in use. All bot activity is logged and can be reviewed in the terminal or order history.

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> **Grid**

A grid is a set of mathematical formulas that defines how orders are placed within the bot’s trading logic, including price levels, order sizes, and how many buy or sell orders to use. It is used to implement grid-based trading strategies or support bots with precise order control.&#x20;

{% hint style="info" %}
**Origami Tech Grids vs. Traditional Grids**\
Manual traders usually think of a grid as a static ladder of limit orders placed at fixed price intervals. In Origami Tech, a grid is much more powerful: it is a programmable, formula-driven structure that can adapt dynamically using variables, conditions, and custom logic. This allows grids to behave intelligently rather than remain fixed on the chart.
{% endhint %}

You can attach several grids to a single bot to shape more detailed trading behavior or layer different strategies together. Each grid works independently, so adding, adjusting, or removing one will not interrupt the bot’s overall activity.

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> **Global Variable**

A global variable is a centralized parameter that can be accessed and used by multiple bots and grids. You can assign it a value, modify it, or delete it at any time. All bots referencing the variable automatically use the updated value.&#x20;

Global variables provide a single point of control for managing settings across bots without editing each bot individually.

### <img src="https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8VkipEEQ5LCx0AWEsoLN%2Fuploads%2FdQ1h9JLEOr3TQ5C1TlQo%2Flogo.png?alt=media&#x26;token=20a9e567-374e-47f3-9494-ab3f8392cdcb" alt="" data-size="line"> **Terminal**

The terminal is a real-time interface for monitoring trading activity. From the terminal, users can view their order histories, inspect logs, and make adjustments to strategies. TradingView charts in the terminal let users follow live market movements without leaving the active workspace.

***

<p align="right"><a href="https://discord.com/invite/origamitech" class="button primary" data-icon="discord">Discord</a></p>


# Key Terms

This glossary provides definitions of the key terms used throughout the platform, as well as general trading terminology.

<table><thead><tr><th width="199.99609375">Term</th><th>Definition</th></tr></thead><tbody><tr><td>API Key</td><td>A secure code issued by an exchange that allows Origami Tech to access an account and execute trades without exposing login credentials. Required for account integration.</td></tr><tr><td>Maker</td><td>Executes orders that add liquidity to the market (limit orders). Post-Only mode ensures a bot only acts as a maker.</td></tr><tr><td>Taker</td><td>Executes orders that remove liquidity (market orders or matched limit orders).</td></tr><tr><td>Spot Market</td><td>A market where assets are traded for immediate settlement at the current price.</td></tr><tr><td>Futures Market</td><td>A market for trading contracts that specify asset delivery at a future date. Requires setting a position mode.</td></tr><tr><td>Order</td><td>An instruction to buy or sell an asset according to the bot’s trading logic. Order history can be reviewed in the terminal.</td></tr><tr><td>Balance</td><td>The total funds in a connected account, including spot and futures holdings. Displayed in the terminal for monitoring.</td></tr><tr><td>Margin</td><td>Funds allocated to open leveraged positions in the futures market. Margin type is selected when configuring a bot.</td></tr><tr><td>Cross Margin Mode</td><td>A margin configuration where the account’s total balance supports all open positions. Reduces liquidation risk by pooling funds across positions.</td></tr><tr><td>Isolated Margin Mode</td><td>A margin configuration where each position has a separate allocation. Losses are confined to the margin assigned to that position.</td></tr><tr><td>Stop Loss</td><td>Closes a position automatically when the asset price reaches a predefined level.</td></tr><tr><td>Take Profit</td><td>Closes a position automatically when a target profit is reached.</td></tr><tr><td>Position Mode</td><td>Determines how futures positions are managed. Selection is required when adding a futures account.</td></tr><tr><td>Preset</td><td>A predefined strategy template that can be applied to a bot for rapid deployment. Can be customized after launch.</td></tr><tr><td>Strategy</td><td>The set of rules and logic a bot follows to execute trades. It can be built manually or adapted from a preset.</td></tr><tr><td>Function</td><td>A calculation or operation that a bot can execute as part of a strategy.</td></tr><tr><td>Variable</td><td>A defined parameter used within a bot’s logic to store and reference a value.</td></tr><tr><td>Error Log</td><td>A record of errors generated during bot operation. Accessible in the terminal or the Bots section for troubleshooting and correction.</td></tr></tbody></table>

***

<p align="right"><a href="https://discord.com/invite/origamitech" class="button primary" data-icon="discord">Discord</a></p>


# Set Up Your Profile

You can be up and using Origami Tech in just a couple of minutes. Here’s what you need to do:

{% stepper %}
{% step %}

### **Go to Origami Tech**

Open your browser and navigate to <https://origami.tech/>

<figure><img src="/files/9yW4gBD6cpDF3FN00ArG" alt="Origami Tech homepage with a hero banner introducing the platform and a ‘Start Trading’ button.”"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### &#x20;**Start the login process**

Click Start Trading in the middle of the Origami Tech page. You’ll be taken to the login screen.

<figure><img src="/files/klmYR3H7vp8lErvuLjbk" alt="Origami Tech login screen with fields for email and password, a Log In button, and an option to continue with Google."><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Create your profile**

* Select Sign Up to create a new account.&#x20;
* Enter your email address and password, confirm your password, and enter your referral code (if applicable).
* Click Sign Up.

<figure><img src="/files/5ICB9dG3pCgyLiWehs6L" alt="Origami Tech sign-up screen showing fields for email, password, password confirmation, optional referral code, and a Sign Up button."><figcaption></figcaption></figure>

{% hint style="info" %}
You can also sign up instantly using your Gmail account.
{% endhint %}
{% endstep %}

{% step %}

### **Verify your account**

* Type in the verification code sent to your inbox.
* Click Log In.
  {% endstep %}
  {% endstepper %}

Once you’re in, you’ll arrive at the Origami Tech platform, which is your main workspace for managing bots, tracking accounts, and monitoring your performance.

Before you start live crypto trading, you’ll need to create your first project. We’ll walk you through that step next.


# Create Project

Creating a project is the first step in organizing your crypto trading bots and exchange accounts. Each project acts as a dedicated workspace that unites multiple exchange accounts around a specific task, such as a trading strategy or bot setup.&#x20;

Set up your first project in Origami Tech with these steps:

{% stepper %}
{% step %}

### **Open the project menu**

* Locate your profile icon in the top-left corner.
* Click the profile icon to open a dropdown menu.
* From the menu, select Add Project.

<figure><img src="/files/si2jEfZ5KnPvKHQAbuFZ" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
You can create multiple projects for different strategies, exchanges, or team workflows.
{% endhint %}
{% endstep %}

{% step %}

### **Fill in project details**

* You will see a form for creating a new project.
* Enter a Project Name. This should be unique to help you recognize the project.
* Click Create to finalize.

<figure><img src="/files/u6XfypG2iEitSgP9SY9A" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Your project is ready. Now you need to link your exchange to Origami Tech to start trading.

***


# Add accounts

An account connects Origami Tech to your cryptocurrency exchange through API keys. It allows the platform to trade on your behalf and keep track of your positions.

To connect your exchange account to the profile:&#x20;

{% stepper %}
{% step %}

### **Open the Accounts tab**

Go to Account in the upper menu bar and select Add Account.

<figure><img src="/files/QMS1qtO9GrQ0ePBEvj5l" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Connect your exchange**

Choose your exchange from the list and follow the on-screen instructions to complete the connection.

<figure><img src="/files/A4o6F0W2wJJuydzv758G" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Make sure you add the IP address 15.235.202.52 to your exchange’s whitelist.

Depending on the exchange, this step might appear later in the instructions, so make sure the IP is included to avoid connection issues.
{% endhint %}
{% endstep %}
{% endstepper %}

Once that’s done, your account will link to Origami Tech. You’ll also see it appear in the Accounts tab.

<figure><img src="/files/Yl842M1zAcfFRo8kvKKO" alt=""><figcaption></figcaption></figure>

Now you are ready to move on to setting up your first bot.

***


# API Key Creation

Follow detailed steps to create and connect exchange API keys to Origami Tech for automated data access, account management, and trade execution.


# Hyperliquid

Learn how to connect your Web3 wallet to Hyperliquid and link it to Origami Tech's crypto trading bot platform for seamless automated crypto trading on a decentralized exchange (DEX).

{% stepper %}
{% step %}

### Step One&#x20;

If you have not already done so, go to the [Hyperliquid](https://app.hyperliquid.xyz/join/ORIGAMI) website and connect your Web3 wallet. You can use the referral code ORIGAMI during onboarding to save on fees.
{% endstep %}

{% step %}

### Step Two

Connect your wallet in the Arbitrum network and make a deposit in USDC. Inside Hyperliquid, click Deposit, select USDC as the asset and Arbitrum as the network, enter your desired amount, and confirm the transaction in your wallet. Once the transaction is complete, go to the Portfolio tab on Hyperliquid and confirm that the funds have arrived.
{% endstep %}

{% step %}

### Step Three

Return to Origami Tech and go to the Terminal tab. Click Add Account and choose Hyperliquid from the exchange selection window.

You will see an important warning: make sure you connect the same wallet you used on Hyperliquid. If you connect a different wallet address, Origami Tech will not be able to link the correct account. Click Connect Wallet, choose your Web3 wallet, and then click Create Account. Your wallet will ask you to sign the action. Confirm the signature to complete the connection.

<figure><img src="/files/fsk5p9TK2UokgAqibBGo" alt="How to connect your Web3 wallet to Hyperliquid and link it to Origami Tech&#x27;s "><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Step Four

Your Hyperliquid account is now linked to Origami Tech's crypto bot trading platform. You can verify the connection in the Terminal tab, where your connected account and available balance will be displayed. At this point, your account is ready for automated crypto trading.
{% endstep %}
{% endstepper %}

## Requirements

Rules for connecting your Hyperliquid account on Origami Tech's platform:

* **Wallet address:** Use the same Web3 wallet address for both Hyperliquid and Origami Tech. A mismatch will prevent the accounts from linking correctly.
* **Network:** Your deposit must be made in USDC on the Arbitrum network.
* **Balance:** Your funds must be available on the Hyperliquid account before the crypto trading bot can execute any trades.

HyperLiquid Spot and Futures accounts are separate account types. When adding an account in Origami Tech, make sure you select the correct type, HyperLiquid Spot or HyperLiquid Futures, as these belong to different exchange types and require separate connections.

## Watch the Video Guide

> Prefer to follow along visually? Watch the video guide below to see how to connect Hyperliquid, fund your account, create your first bot, and launch it with Origami Tech step by step.

{% embed url="<https://www.youtube.com/watch?v=4dHLi0ouT3Q>" %}


# Binance

Follow this guide to create and connect Binance API keys to Origami Tech, enabling secure automated trading and data synchronization.

## Step One

If you haven't already, go to [Binance's](https://accounts.binance.com/register?ref=36381716) website and create an account. Proceed with KYC.

## **Step Two**

Verify your account and get started with creation of sub-account

<figure><img src="/files/cSycWE50rxVQe23YvTUc" alt="binance API for origami tech, go to Account management menu"><figcaption></figcaption></figure>

<figure><img src="/files/7JJO3WUTOpOHWGG2QKEG" alt="binance api for origami tech, click on &#x22;create sub account&#x22; "><figcaption></figcaption></figure>

<figure><img src="/files/FHRhVI8oreIlfQEBTmFe" alt="binance api for origami tech, name the account"><figcaption></figcaption></figure>

## Step Three

<figure><img src="/files/Nq79fB1mp0DdouIKZ0Ud" alt="binance api for origami tech, go to API management "><figcaption></figcaption></figure>

<figure><img src="/files/eVzEPboufUYu0tyy7nqv" alt="binance api for origami tech, select system generated API key"><figcaption></figcaption></figure>

Click on “Create API”, select “System generated API Key” and click on Next.

<figure><img src="/files/c1uh9SgwrDvnqQVQrF2m" alt="binance api for origami tech, select sub account and give a label to the API key"><figcaption></figcaption></figure>

## Step Four

<figure><img src="/files/ajSU23MHksYIMM5ayp1h" alt="binance api for origami tech, go through security verification"><figcaption></figcaption></figure>

To complete the puzzle, slide the puzzle piece into place. Afterwards, you must verify your API Keys by using all of the following methods: phone number verification code, email verification code, and authenticator code.

## **Step Five**

Enable Restrict access to trusted IP’s only.&#x20;

Add **15.235.202.52** and click Confirm

<figure><img src="/files/1XB0fTnnT4WZYvJXL4Jn" alt="binance api for origami tech, set up API"><figcaption></figcaption></figure>


# Bybit

Step-by-step guide to creating and integrating Bybit API keys with Origami Tech for secure, automated trading and account management.

## Step One

If you haven't already, go to [Bybit's](https://partner.bybit.com/b/85238) website and create an account. Proceed with KYC.

## Step Two

Verify your account and get started by navigating to Sub-Account settings

<figure><img src="/files/0g7o5vXI7Cm4uCmXtldp" alt="bybit api for origami tech, go to subaccount menu"><figcaption></figcaption></figure>

<figure><img src="/files/REDGXpJb88rrNBROTQxX" alt="bybit api for origami tech, create subaccount"><figcaption></figcaption></figure>

<figure><img src="/files/L6KiXpnlpoAjjId2IOgU" alt="bybit api for origami tech, select unified trading subaccount"><figcaption></figcaption></figure>

Сhoose subaccount name and use Unified Trading Account

<figure><img src="/files/PVkbi7OJ9nd0fOlxd403" alt="bybit api for origami tech, create subaccount"><figcaption></figcaption></figure>

Confirm Subaccount creation via Verification codes

## Step Three

Click on Sub-Account settings again&#x20;

After creating Sub-Account, click on Management under API note

<figure><img src="/files/X8HPvOD2VIIyoyEKhWKC" alt="bybit api for origami tech, in subaccount menu click on &#x22;management&#x22; under API"><figcaption></figcaption></figure>

Then, click on Create New Key

<figure><img src="/files/nph0EwDLXeomLBo0eg77" alt="bybit api for origami tech, click create new key"><figcaption></figcaption></figure>

Сhoose System-Generated Key API Keys

<figure><img src="/files/yNwc7tkCFOb51t7yPaQ6" alt="bybit api for origami tech, choose system generated API key"><figcaption></figcaption></figure>

<figure><img src="/files/GGgmFxWgBpPaIMGHGV21" alt="bybit api for origami tech, set up the API"><figcaption></figcaption></figure>

Add name to API key, Click on all Tickboxes as shown on the screen, add this IP to whitelist: **15.235.202.52**

Click Submit


# OKX

Follow this guide to create OKX API keys and connect them to Origami Tech for secure trading automation and multi-market execution.

## Step One

If you haven't already, go to [OKX](https://www.okx.com/join/3802272) website and create an account. Proceed with KYC.

## Step Two

Verify your account, add 2FA and get started with creation of sub-account

<figure><img src="/files/gUU3pQ7m5TtU4TP2LKYK" alt="okx api for origami tech, go to sub-accounts menu"><figcaption></figcaption></figure>

<figure><img src="/files/pB4ZHdq9rYl5IXg9nxxY" alt="okx api for origami tech, create sub-account"><figcaption></figcaption></figure>

Create a login name to Sub-account and use Standard sub-account → click on Submit all

<figure><img src="/files/02yrF3RePCABITRPDFNW" alt="okx api for origami tech, set up sub-account "><figcaption></figcaption></figure>

Complete creation of Sub-account with 2FA

<figure><img src="/files/SWUrFBJNYGXBrfixCNr5" alt="okx api for origami tech, 2 factor authentication "><figcaption></figcaption></figure>

## Step Three

Go to Sub-account page and click on Action → Manage API

<figure><img src="/files/xSG5lZf82IUxZ3yEoprp" alt="okx api for origami tech, go to actions, manage API"><figcaption></figcaption></figure>

Create API Name, choose Account (sub-account if created previously, Main if not).&#x20;

Use API trading Purpose, link this IP address to allowlist: **15.235.202.52**

Permissions: Read, Trade&#x20;

Come up with Passphrase (you must remember it)

<figure><img src="/files/sW4KkDJso4CXhjw7T48z" alt="okx api for origami tech, set up api"><figcaption></figcaption></figure>

Click on Submit all and proceed with Email and 2FA to finish API creation


# Gate io

Guide to creating and linking Gate.io API keys with Origami Tech, enabling seamless automated trading and exchange account management.

## Step One

If you haven't already, go to [Gate’s](https://www.gate.io/signup/XlBHVllf?ref_type=103) website and create an account. Proceed with KYC.

## Step two

Verify your account and get started on the API by navigating to API Management.

<figure><img src="/files/roDXndIHyBOhAnM6L1rL" alt="gate io api for origami tech, go to api management "><figcaption></figcaption></figure>

<figure><img src="/files/I20jKxb0e0Q97nEn2qGU" alt="gate io api for origami tech, create api key"><figcaption></figcaption></figure>

## Step Three

Come up with API Key Remark, add this IP to IP Permissions: **15.235.202.52** Use v4 API Key and Trading Account

Choose Spot→ Read and Write, Perpetual Futures → Read and Write, Delivery Futures → Read and Write, Wallet→ Read Only, Option → Read and Write, Comission Details → Read and Write, Account → Read Only, Margin Trading → Read and Write, Loan → Read and Write as shown on the screenshot below

Click on submit

<figure><img src="/files/L7qfJ6LYCugZiZ4qBVXf" alt="gate io api for origami tech, create api key"><figcaption></figcaption></figure>

## Step Four

Tick the checkboxes and complete creation with Fund Password, 2FA and Verification Code

<figure><img src="/files/Cg8oG74Tmtn6zdKZwMaV" alt="gate io api for origami tech, risk reminder"><figcaption></figcaption></figure>


# Mexc

Learn how to generate and connect Mexc API keys to Origami Tech for secure, automated trading and real-time account synchronization.

## Step One

If you haven't already, go to [MEXC](https://www.mexc.com/register?inviteCode=mexc-1DZ7R) website and create an account. Proceed with KYC.

## Step Two

Verify your account, add 2FA and get started with creation of sub-account

<figure><img src="/files/96nJifkW8GpoKLJtcncJ" alt="mexc api for origami tech, going to sub-account management "><figcaption></figcaption></figure>

<figure><img src="/files/TUEC9gjCvzxe5PjsAmd6" alt="mexc api for origami tech, create sub-account "><figcaption></figcaption></figure>

Choose Trade only trhough the API, no login permissions.

<figure><img src="/files/DgzlGhdvk5qQUUjqHfGJ" alt="mexc api for origami tech, select option change through api only"><figcaption></figcaption></figure>

Add a name to sub-account

<figure><img src="/files/EUluxOqloKk56LOMr4aD" alt="mexc api for origami tech, creating sub-account "><figcaption></figcaption></figure>

## Step Three

Go to Sub-account page and click on API

<figure><img src="/files/5CKlxJftr8UrUhLTSiZE" alt="mexc api for origami tech, from sub-account go to api set up"><figcaption></figcaption></figure>

Choose Sub-account and click tickboxes as shown below on the screen.&#x20;

Also link this IP address: **15.235.202.52**

<figure><img src="/files/UW9TKODO2Nei0ggFt7UQ" alt="mexc api for origami tech, set up new api key"><figcaption></figcaption></figure>

Click on Create


# Kucoin

Learn how to create and integrate Kucoin API keys with Origami Tech for safe, automated trading and cross-exchange account management.

## Step One

If you haven't already, go to [Kucoin's](https://www.kucoin.com/r/af/rJ3943S) website and create an account. Proceed with KYC.

## Step Two

Verify your account, add 2FA and get started with creation of sub-account

<figure><img src="/files/FTuznVnSwjGKI6BmPIDZ" alt="kucoin api for origami tech, go to sub-account settings "><figcaption></figcaption></figure>

<figure><img src="/files/cGfBqOdt0JVsdzo3GVzh" alt="kucoin api for origami tech, create sub-account"><figcaption></figcaption></figure>

Add a name to sub-account, click on all permissions, add your Login Password and choose General Sub-Account

<figure><img src="/files/Pbw6jHR72bDiI7HhWTOU" alt="kucoin api for origami tech, create sub-account"><figcaption></figcaption></figure>

Complete creation with 2FA and your trading password

## Step Three

Go to Sub-account page and click on Settings → View API

<figure><img src="/files/rMa3Jx2huIbMowmKDiN6" alt="kucoin api for origami tech, view api "><figcaption></figcaption></figure>

Choose a Name for API, Add Passphrase (You must remember), add Spot Trading permission.

Click on “Yes” in IP Restriction setting, add this IP: **15.235.202.52** and click on “Add”

<figure><img src="/files/f0uFJmcQEgmf5hnuxWcM" alt="kucoin api for origami tech, create api"><figcaption></figcaption></figure>


# BingX

Learn how to create BingX API keys and connect them to Origami Tech for automated strategy deployment and account synchronization.

## Step One

If you haven't already, go to [BingX’s ](https://bingx.com/)website and create an account. Proceed with KYC.

## Step Two

Verify your account and get started with creation of sub-account

<figure><img src="/files/2PLRRNk5go7H5zmRO2qv" alt="bingx api for origami tech, go to sub-account settings"><figcaption></figcaption></figure>

<figure><img src="/files/QwbDsJ103hyTDQ48E3YI" alt="bingx api for origami tech, create sub-account"><figcaption></figcaption></figure>

## Step Three

<figure><img src="/files/c7DCH0gmFIKE4f1yYhSd" alt="bingx api for origami tech, create sub-account"><figcaption></figcaption></figure>

<figure><img src="/files/tz6cYsOsOL7XpMzvjwxD" alt="bingx api for origami tech, go to api management settings"><figcaption></figcaption></figure>

Click "Create API," choose the account, give it a name, enter the email code and Google Authenticator code. Stick with the Main account unless you're using sub-accounts.

## Step Four

Label the API key, Tick on Spot Trading and Perpetuals Futures Trading, add this IP to Whitelist: **15.235.202.52**

<figure><img src="/files/JvlgWLEju5xGsqPaqwTd" alt="bingx api for origami tech, create api key"><figcaption></figcaption></figure>

Click Confirm


# Bitget

Learn how to generate and link Bitget API keys with Origami Tech to enable secure trading automation and multi-exchange account access.

## Step One

If you haven't already, go to [Bitget](https://www.bitget.com/) website and create an account. Proceed with KYC.

## Step Two

Verify your account and get started with creation of sub-account

<figure><img src="/files/xApMWAVPh6nn8ItzCJt8" alt="sub account creation, bitget api for origami tech"><figcaption></figcaption></figure>

<figure><img src="/files/QkO2BbHHSIElQyUx3Wcn" alt=" bitget api for origami tech, create sub-account"><figcaption></figcaption></figure>

<figure><img src="/files/TSwacWlURa9aO1W0ry0K" alt=" bitget api for origami tech, select virtual sub account "><figcaption></figcaption></figure>

Choose Virtual sub-account, add a name to sub-account

## Step Three

Go to Sub-account page and click on API management

<figure><img src="/files/lVKHMBE0NUWzelXDxsAg" alt=" bitget api for origami tech, go to api management "><figcaption></figcaption></figure>

<figure><img src="/files/4XZvctd4S8XZSm0oHazm" alt=" bitget api for origami tech, create api key"><figcaption></figcaption></figure>

<figure><img src="/files/0kJLj5fDNunikHfBChJO" alt=" bitget api for origami tech, select system generated api key"><figcaption></figcaption></figure>

Choose System-generated API key.&#x20;

Add Note, Passphrase (You must remember), Read-write permission, Futures → Orders, Holdings, Spot → Trade, Margin → Trade, Wallet → Transfer and bind this IP address to API keys: **15.235.202.52**

Complete Security Verification.


# BitMart

Step-by-step instructions for connecting BitMart API keys to Origami Tech to enable automated trading and secure account access.

## Step One

If you haven't already, go to [Bitmart's](https://www.bitmart.com/) website and create an account. Proceed with KYC.

## Step Two

Verify your account and get started on the API by navigating to API Management.

<figure><img src="/files/dYgwkSPA6dEWcfVayej2" alt="bitmart api for origami tech, api management "><figcaption></figcaption></figure>

## Step Three

<figure><img src="/files/JRpVL0mZ2cmiJTxqRyGu" alt="bitmart api for origami tech, set up api"><figcaption></figcaption></figure>

Add Memo, which you will remember, click on Spot-Trade, Margin-Trade, Future-Trade and add this IP to be binded: **15.235.202.52**


# Bitrue


# Coinstore


# CoinW


# Deepcoin


# DigiFinex


# HitBtc


# LBank


# P2b


# Poloniex


# ProBit


# Set Up First Bot

Here you’ll find step-by-step guides for getting started with bots.

{% stepper %}
{% step %}

### **Open the Bots tab**

* In the top menu, select the Bots tab. This page shows any existing bots.
* Click the + Add Bot button in the top-right corner.

<figure><img src="/files/YyvvPG93GtAKOCaxDX2W" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Provide bot information**

* Fill in the basic bot details:

*Bot name: Name your bot (e.g., Spot\_trading or Futures\_trading).*

*Account: Choose the exchange account the bot will operate on.*

*Coins: Select the trading pair.*

<figure><img src="/files/FP7DRLHcUCAI32LWEMiq" alt=""><figcaption></figcaption></figure>

* For the futures bot, two extra fields are required:

*Margin mode: Choose Cross (shares margin across all positions in the account) or Isolated (margin is allocated to a single position only).*

*Leverage: Select the leverage level. Higher leverage increases potential profits and risk.*

<figure><img src="/files/DW4P9GEt8m9afTuVT6SQ" alt=""><figcaption></figcaption></figure>

* Click Create Bot to proceed.
  {% endstep %}

{% step %}

### **Select a preset**

* Click Import Preset.

<figure><img src="/files/H98hUCHahvoMOmJSyvpr" alt=""><figcaption></figcaption></figure>

* Choose a preset from the pop-up window.

<figure><img src="/files/qdD1maVn6eC0vuyNF2FQ" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Review and import the preset**

* Depending on the preset, you may see parameters to review. Some presets show no parameters. Both scenarios are expected.

<figure><img src="/files/del2DGV0WqK4TkwNN6Bw" alt=""><figcaption></figcaption></figure>

* Click Import to load the configuration.
* The preset values fill the bot input form automatically. Modify them if needed, then click Import once again to finalize.

<figure><img src="/files/9XqCsv4lAwg5I1MtgYbr" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Activate your bot and start receiving data**

* Navigate to the Bots tab.

<figure><img src="/files/W3iXKGmobtclJoe9Q5Wq" alt=""><figcaption></figcaption></figure>

* Find your newly created bot.
* Click the power icon to switch the bot on.

<figure><img src="/files/QkesKWdzlnTydC5hu3gg" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

Your bot is now active and receiving live data.&#x20;

**Great job!**

With your first project created, your account connected, and your bot running a simple grid strategy, you’re all set for the next steps. Now, let’s explore how to build more sophisticated bots and tailor advanced strategies.


# Create Spot Bot

Follow a complete guide to build, configure, and deploy a Spot trading bot in Origami Tech, automate trading logic, and monitor performance effectively.

## **Step 1: Adding a New Bot**

### 1. **Open the "Bots" section**

In the top menu of your platform, locate and click on the "Bots" tab. This page displays any existing bots (if available).

### 2. **Click "Add Bot"**

To create a new bot, click the "Add Bot" button located in the top-right corner of the screen, as indicated by the arrow in the screenshot.

<figure><img src="/files/MPQ7AYH5Y8ld4FfXEJao" alt="how to create spot bot on Origami tech, click &#x22;add bot&#x22; "><figcaption></figcaption></figure>

## **Step 2: Entering Bot Information**

### 1. Provide the basic information about the bot

&#x20;A form will appear for entering the details of the new bot. Fill in the following fields:

* **Bot Name**: Enter the name of your bot (e.g., "Grid\_bot").
* **Account**: Select the exchange account that the bot will operate on.
* **Coins**: Specify the base currency (*Base Coin*) and the counter currency (*Counter Coin*) for the trading pair.

### 2. Click "Next"

After entering the required information, click the "Next" button to proceed to the next step.

<figure><img src="/files/1JxNHL0BOZaf323JmeT8" alt="how to create a spot bot in origami tech, fill in bot details"><figcaption></figcaption></figure>

## **Step 3: Configuring Trading Bot Parameters**

### 1. **Set Strategy Parameters**

In this step, you need to define the parameters that will guide the bot's trading actions:

* [**execute\_price**](/function/required-parameters/execute-price#execute_price-decimal-or-formula-greater-than-decimal): Specify the execution price. You can use the `ticker()` function to automatically set the current price.
* [**execute\_volume**](/function/required-parameters/execute-volume#execute_volume-decimal-or-formula-greater-than-decimal): Enter the trading volume in units of the base currency.
* [**buy\_orders\_count**](/function/required-parameters/buy-orders-count#buy_orders_count-integer-or-formula-greater-than-integer) and [**sell\_orders\_count**](/function/required-parameters/sell-orders-count#sell_orders_count-integer-or-formula-greater-than-integer): Define the number of buy and sell orders the bot should place.

### 2. **Save Configuration**

After setting all the parameters, click **Save** to store the bot's configuration.

The bot will now be ready to operate based on the defined trading strategy.

<figure><img src="/files/3YfDROVFKfQTKFLaeJvZ" alt="setting up the new spot trading bot"><figcaption></figcaption></figure>

## Step 4:  Import Preset

### 1. Select a Preset

* Click the **Import Preset** button.
* In the pop-up window, choose the desired preset from the list.
* You can switch between **Bot** (global strategies) and **Grid** (order grids) categories.

<figure><img src="/files/HfR4ECdzbHnGfKvPqIh7" alt="import preset to the origami spot bot "><figcaption></figcaption></figure>

### 2. Import Settings

* Review the preset parameters on the right side of the window.
* Click **Import** to load the selected configuration.

<figure><img src="/files/4U9Qpoumd306aiH03b6G" alt="importing preset settings for spot bot on Origami tech"><figcaption></figcaption></figure>

### 3. Modifying Parameters Before Importing

* After selecting a preset, its parameters will be displayed on the right side of the window.
* The values of the variables can be modified before importing, allowing users to customize the strategy to fit their needs.

<figure><img src="/files/SkMZZaNvLXGavph5gXTi" alt="modifying the preset settings on origami tech "><figcaption></figcaption></figure>

### 4. Edit and Launch

* After importing, the preset parameters will automatically fill in the bot creation form.
* You can modify them before saving.
* Click **Save** to save the bot or **Save and Exit** to exit.

***


# Create Futures Bot

Build and manage a futures trading bot in Origami Tech. Learn to define leverage, margin settings, and position logic for automated strategy execution.

## **Step 1: Adding a New Bot**

### 1. **Open the "Bots" section**

In the top menu of your platform, locate and click on the "Bots" tab. This page displays any existing bots (if available).

### 2. **Click "Add Bot"**

To create a new bot, click the "Add Bot" button located in the top-right corner of the screen, as indicated by the arrow in the screenshot.

<figure><img src="/files/MPQ7AYH5Y8ld4FfXEJao" alt="Create Futures Bot on Origami tech, click &#x22;add bot&#x22; in the top right corner"><figcaption></figcaption></figure>

## **Step 2: Entering Bot Information**

### 1. Provide the basic information about the bot

&#x20;A form will appear for entering the details of the new bot. Fill in the following fields:

* **Bot Name**: Enter the name of your bot (e.g., "Grid\_bot").
* **Account**: Select the exchange account that the bot will operate on.
* **Coins**: Specify the base currency (*Base Coin*) and the counter currency (*Counter Coin*) for the trading pair.
* **Margin Mode**: Choose between **Cross** and **Isolated** margin mode.
* **Leverage**: Select the leverage level for the bot. Higher leverage increases potential profits but also increases risk.

### 2. Click "Next"

After entering the required information, click the "Next" button to proceed to the next step.

<figure><img src="/files/ptGEaUnzhZSAXLwMLTKn" alt="setting up Create Futures Bot in origami tech "><figcaption></figcaption></figure>

## **Step 3: Configuring Trading Bot Parameters**

### 1. **Set Strategy Parameters**

In this step, you need to define the parameters that will guide the bot's trading actions:

* [**execute\_price**](/function/required-parameters/execute-price#execute_price-decimal-or-formula-greater-than-decimal): Specify the execution price. You can use the `ticker_futures()` function to automatically set the current price.
* [**execute\_volume**](/function/required-parameters/execute-volume#execute_volume-decimal-or-formula-greater-than-decimal): Enter the trading volume in units of the base currency.
* [**buy\_orders\_count**](/function/required-parameters/buy-orders-count#buy_orders_count-integer-or-formula-greater-than-integer) and [**sell\_orders\_count**](/function/required-parameters/sell-orders-count#sell_orders_count-integer-or-formula-greater-than-integer): Define the number of buy and sell orders the bot should place.

### 2. **Save Configuration**

After setting all the parameters, click **Save** to store the bot's configuration.

The bot will now be ready to operate based on the defined trading strategy.

<figure><img src="/files/SP5FA48B20spa3brc6fM" alt="Step 3: Configuring Trading Bot Parameters on origami tech"><figcaption></figcaption></figure>

## Step 4:  Import Preset

### 1. Select a Preset

* Click the **Import Preset** button.
* In the pop-up window, choose the desired preset from the list.
* You can switch between **Bot** (global strategies) and **Grid** (order grids) categories.

<figure><img src="/files/PlypRUHBTOAENFmMCRTU" alt="importing project preset for futures trading bot on origami tech"><figcaption></figcaption></figure>

### 2. Import Settings

* Review the preset parameters on the right side of the window.
* Click **Import** to load the selected configuration.

<figure><img src="/files/8mGUTRLrBn2iWdZi5qSv" alt="importing future bot settings on origami tech"><figcaption></figcaption></figure>

### 3. Modifying Parameters Before Importing

* After selecting a preset, its parameters will be displayed on the right side of the window.
* The values of the variables can be modified before importing, allowing users to customize the strategy to fit their needs.

<figure><img src="/files/f0Q9YBMklzQB9FTeIWKA" alt="Modifying Parameters Before Importing in origami tech"><figcaption></figcaption></figure>

### 4. Edit and Launch

* After importing, the preset parameters will automatically fill in the bot creation form.
* You can modify them before saving.
* Click **Save** to save the bot or **Save and Exit** to exit.

***


# Create Grid

Learn how to design and configure grid strategies in Origami Tech. Create dynamic order placement logic for market-making and trading automation.

## **Before Creating a Grid**

#### 1. **Ensure the following prerequisites are completed:**

* **Create a project**: Follow the steps to create a new project.
* **Add an account**: Link your exchange account to the platform.
* **Create a bot**: Set up a bot with the necessary parameters.

#### 2. **Proceed to create a grid:**

Once the above steps are completed, click the **plus button ("+")** to begin configuring the grid.

<figure><img src="/files/bj5wfJwogo06m0aFXUoq" alt="how to Create Grid on origami tech"><figcaption></figcaption></figure>

## **Creating a Grid: Initial Setup**

#### **1. Click the "+" button**

After clicking the **plus button ("+")**, a basic grid configuration will automatically appear, pre-filled with default values.

#### **2. Default settings**

* A single **buy order** will be placed at the **last trade price** for the current pair and exchange, as determined by the bot's configuration ( [<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)`()`).
* The **order size** is set to **100 tokens** of the base currency ([<mark style="color:blue;">Base</mark>](/function/shortcuts#base)).

These pre-filled values provide a quick start, allowing you to adjust further settings as needed.

<figure><img src="/files/l4l6Oo6Mqne8ku1j8iEG" alt="Create Grid on origami tech "><figcaption></figcaption></figure>

## Mandatory Fields:

### 1. [<mark style="color:purple;">execute\_price</mark>](/function/required-parameters/execute-price):&#x20;

* **Type**: Number
* **Description**: The price levels at which orders will be placed.
* **Formula**: Prices are calculated based on the parameter **order\_pos**, which determines the relative position of the orders.
  * **For Buy Orders**: The `order_pos` parameter takes values in the range `[-1,...,-`[<mark style="color:purple;">`buy_orders_count`</mark>](/function/required-parameters/buy-orders-count)`].`
  * **For Sell Orders**: The `order_pos` parameter takes values in the range`[1,...,`[<mark style="color:purple;">`sell_order_count`</mark>](/function/required-parameters/sell-orders-count)`]`.

This parameter ensures the grid accurately places multiple orders at varying price levels, both above and below the market price.

<details>

<summary>Example:</summary>

[<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`()`</mark>&#x20;

[<mark style="color:blue;">`orderbook`</mark>](/function/structures#orderbook)<mark style="color:red;">`().`</mark>[<mark style="color:blue;">`bid`</mark>](/function/structures#groupbalance)<mark style="color:red;">`[0].`</mark>[<mark style="color:blue;">`price`</mark>](/function/structures/orderbook)&#x20;

[<mark style="color:blue;">`orderbook`</mark>](/function/structures#orderbook)<mark style="color:red;">`().`</mark>[<mark style="color:blue;">`ask`</mark>](/function/structures/orderbook)<mark style="color:red;">`[0].`</mark>[<mark style="color:blue;">`price`</mark>](/function/structures/orderbook)<mark style="color:red;">`* (1 +`</mark> [<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters#order_pos-integer) <mark style="color:red;">`* 0.005)`</mark>&#x20;

<mark style="color:red;">`1000.05`</mark>

<mark style="color:red;">`1000.05 * (1 +`</mark> [<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters#order_pos-integer)<mark style="color:red;">`* 0.005)`</mark>&#x20;

<mark style="color:red;">`1000 if`</mark> [<mark style="color:blue;">`side`</mark>](/function/pre-defined-parameters#side-string)<mark style="color:red;">`=='`</mark>[<mark style="color:blue;">`buy`</mark>](/function/pre-defined-parameters#order_pos-integer)<mark style="color:red;">`' else 1500`</mark>

</details>

### **2.** [<mark style="color:purple;">execute\_volume</mark>](/function/required-parameters/execute-volume#execute_volume-decimal-or-formula-greater-than-decimal):

* **Type**: Number
* **Description**: The trading volume for each order, expressed in the **Base** token.
* **Formula**: The volume is calculated based on the **order\_pos** parameter:
  * **For Buy Orders**: `order_pos` takes values from `[-1,...,-`[<mark style="color:purple;">`buy_orders_count`</mark>](/function/required-parameters/buy-orders-count)`].`
  * **For Sell Orders**: `order_pos` takes values from `[1,...,`[<mark style="color:purple;">`sell_order_count`</mark>](/function/required-parameters/sell-orders-count)`]`.

This parameter determines the amount of the base currency to be traded at each price level, ensuring consistent volume allocation across the grid.

<details>

<summary>Example:</summary>

[<mark style="color:blue;">`orderbook`</mark>](/function/structures#orderbook)<mark style="color:red;">`().`</mark>[<mark style="color:blue;">`ask`</mark>](/function/structures/orderbook)<mark style="color:red;">`[0].`</mark>[<mark style="color:blue;">`amount`</mark>](/function/structures/orderbook)

[<mark style="color:blue;">`orderbook`</mark>](/function/structures#orderbook)<mark style="color:red;">`().`</mark>[<mark style="color:blue;">`bid`</mark>](/function/structures#groupbalance)<mark style="color:red;">`[0].`</mark>[<mark style="color:blue;">`amount`</mark>](/function/structures/orderbook)<mark style="color:red;">`* (1 +`</mark> [<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters#order_pos-integer) <mark style="color:red;">`* 0.005)`</mark>&#x20;

<mark style="color:red;">`5250.75`</mark>&#x20;

<mark style="color:red;">`5250.75 /`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)

<mark style="color:red;">`5250.75 /`</mark> [<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`()`</mark>&#x20;

<mark style="color:red;">`1000.05 +`</mark> [<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters#order_pos-integer) <mark style="color:red;">`* 0.005`</mark>&#x20;

<mark style="color:red;">`1000 if`</mark> [<mark style="color:blue;">`side`</mark>](/function/pre-defined-parameters#side-string)<mark style="color:red;">`=='`</mark>[<mark style="color:blue;">`buy`</mark>](/function/pre-defined-parameters#order_pos-integer)<mark style="color:red;">`' else 1500`</mark>

</details>

### **3.** [<mark style="color:purple;">buy\_order\_count</mark>](/function/required-parameters/buy-orders-count):

* **Type**: Number
* **Description**: The number of buy orders (**bid**) to be placed for the [**Base** ](/function/shortcuts/base#base)token.
* **Formula**: Defines the total count of buy orders, with prices determined using the **order\_pos** parameter in the range `[-1,...,-`[<mark style="color:purple;">`buy_orders_count`</mark>](/function/required-parameters/buy-orders-count)`]`.

### **4.** [<mark style="color:purple;">**sell\_order\_count**</mark>](/function/required-parameters/sell-orders-count#sell_orders_count-integer-or-formula-greater-than-integer)**:**

* **Type**: Number
* **Description**: The number of sell orders (**ask**) to be placed for the  [**Base**](/function/shortcuts/base#base) token.
* **Formula**: Defines the total count of sell orders, with prices determined using the **order\_pos** parameter in the range `[1,...,`[<mark style="color:purple;">`sell_order_count`</mark>](/function/required-parameters/sell-orders-count)`]`.

These parameters ensure that the grid creates the specified number of buy and sell orders at their respective price levels.

<details>

<summary>Example:</summary>

<mark style="color:red;">`5`</mark>&#x20;

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`() > 0.05 else 0`</mark>&#x20;

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`balance`</mark>](/function/functions/balance)<mark style="color:red;">`('counter').`</mark>[<mark style="color:blue;">`total`</mark>](/function/technical-analysis/stop-and-reverse) <mark style="color:red;">`< 5000 else 0`</mark>&#x20;

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/structures/groupbalance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').`</mark>[<mark style="color:blue;">`current`</mark>](/function/technical-analysis/relative-strenght-index)<mark style="color:red;">`.`</mark>[<mark style="color:blue;">`total`</mark>](/function/technical-analysis/stop-and-reverse) <mark style="color:red;">`> 10000 else 0`</mark>

</details>

## **Optional Fields**

### 1. [<mark style="color:purple;">time\_between\_orders</mark>](/function/optional-parameters/time-between-orders):&#x20;

* **Type**: Number
* **Description**: The time interval (in seconds) between placing successive orders in a single grid.
* **Purpose**: Reduces the frequency of API requests to the exchange, helping avoid exceeding the exchange's rate limits.

### 2. [<mark style="color:purple;">**sleep\_after\_seconds**</mark>](/function/optional-parameters/sleep-after-seconds#sleep_after_seconds-greater-than-decimal):

* **Type**: Number
* **Description**: The time interval (in seconds) between grid updates.
* **Purpose**: Controls how often the grid is refreshed, balancing performance and API usage efficiency.

These fields are not mandatory but can optimize grid operations by managing API request frequency and reducing the likelihood of exceeding exchange limits.

<details>

<summary>Example:</summary>

<mark style="color:red;">`300`</mark>&#x20;

<mark style="color:red;">`300 * (1 +`</mark> [<mark style="color:blue;">`random`</mark>](/function/functions/random)<mark style="color:red;">`())`</mark>&#x20;

<mark style="color:red;">`300 + 150 *`</mark> [<mark style="color:blue;">`random`</mark>](/function/functions/random)<mark style="color:red;">`()`</mark>

</details>

## **Post-Only**

* **Description**: When this option is enabled, users act as market makers.
* **Functionality**:
  * If the **Post-Only** option is selected, any limit order you place will never immediately match with an existing order in the order book.
  * Instead, it ensures that your order always enters the order book as a maker order, providing liquidity rather than taking it.

This option is useful for users looking to avoid taker fees or ensure their orders contribute to market liquidity.

## **Working with the Grid**

### 1. **Activating the Grid**

* To activate the grid, toggle the **Toggle Switch** to the **enabled** state.

This action will initiate the grid and start executing the configured trading strategy.

<figure><img src="/files/qwklxVrIitW8MWaQdbDO" alt="activating grid on origami tech"><figcaption></figcaption></figure>

## **Adding Additional Parameters**

* To create and configure additional parameters for your grid, click the **+ Add Row** button.

This allows you to define custom settings or expand the functionality of your grid configuration as needed.

<figure><img src="/files/pMWeODbTxfNb9LpGhfJE" alt="adding parameters to the grid"><figcaption></figcaption></figure>

## **Configuring Additional Parameters**

### **1. Enter Variable Name and Value**

* In the newly added row, input the **variable name** and its corresponding **value**.
* You can create auxiliary parameters to be used in formulas for more advanced configurations.

### 2. **Save Changes**

* After making any adjustments to the grid, ensure you **save the changes** to apply the new settings.

This approach enables dynamic and flexible grid customization tailored to specific trading strategies.

<figure><img src="/files/frszbwcNOzjkxwgTabZv" alt="save changes on origami tech new grid"><figcaption></figcaption></figure>

## **Previewing Calculated Orders**

* To view the pre-calculated orders based on the logic defined in the grid, click the **Research** button.

This feature allows you to verify and analyze the orders before activation, ensuring the grid is configured correctly and aligns with your trading strategy.

<figure><img src="/files/o1Q2yONRskJe8e4J49cY" alt="Previewing Calculated Orders on origami tech"><figcaption></figcaption></figure>

#### Custom parameter with floating point (decimal) value

It is possible to create custom parameters with decimal or integer value

*Example:*

*Create custom parameter <mark style="color:red;">`spread`</mark>* *and use it in* [<mark style="color:purple;">execute\_price</mark>](/function/required-parameters/execute-price)

#### Custom formula

Also, it is possible to create custom formula as parameter’s value and use parameter’s key as alias for it.

1. Define new parameter with some name (ex:  <mark style="color:red;">`spread`</mark>)
2. Define parameter value with some formula (ex: [<mark style="color:blue;">`random`</mark>](/function/functions/random)<mark style="color:red;">`() * 2`</mark>)

An example of using additional parameters to set a grid with a spread of 1% and a step of 2% for subsequent orders.

```json
{
"execute_price": "ticker() * (1 - spread / 2 + order_pos * gap if side=='buy' else 1 + spread / 2 + order_pos * gap)",
"execute_volume": "50 / execute_price",
"buy_orders_count": "3",
"sell_orders_count": "3",
"spread": "0.01",
"gap": "0.02"
}
```

<figure><img src="/files/YwYcQ92ezUvFMcfpBios" alt="creating custom formula on the grid for origami tech"><figcaption></figcaption></figure>

## **Editing in JSON Format**

### 1. **Switch to JSON Mode**

* Click the **Turn into JSON** button to enable editing the grid in JSON format.

### 2. Use Cases:

* Quickly **insert** a previously saved or pre-written grid configuration.
* **Copy** the current grid settings for reuse or backup.
* Make detailed edits directly in the JSON structure for faster and precise adjustments.

### 3. Save Changes

* After editing, ensure you save the configuration to apply the updates.

This feature is ideal for users who prefer direct JSON manipulation or need to efficiently manage complex grid setups.

<figure><img src="/files/hM2FpzhUkq2fBw9XUyWb" alt="save changes on the grid on origami tech"><figcaption></figcaption></figure>

## **Verifying Variables Before Saving**

1. **Preview Variables**
   * Before saving your changes in JSON format, click the **Show Form** button.
2. **Purpose**:
   * This step ensures that all variables and parameters are correctly recorded and properly mapped to the grid's logic.
3. **Save Changes**
   * Once verified, proceed to save the configuration to finalize the grid setup.

This process helps avoid errors and ensures the grid operates as intended.

<figure><img src="/files/oWWGQbCzx4atPWBj1xwl" alt="Verifying Variables Before Saving on origami tech"><figcaption></figcaption></figure>

<figure><img src="/files/w6BqFmjDvfPjoJgLCuev" alt="save form and Verifying Variables Before Saving"><figcaption></figcaption></figure>

<figure><img src="/files/ZKXH6hc08StKsjC8gnbO" alt="bot grid set up on origami tech"><figcaption></figcaption></figure>

***


# Grids Examples

Discover multiple grid trading examples in Origami Tech that demonstrate strategy structure, order placement, and optimization for various market conditions.

<details>

<summary>Grid 1: <a href="/pages/7DXMPVsmVv4qE0zWkr1F">Selling at the Best Price with Minimum Price and Balance Constraints</a></summary>

```json
{
"gap": "0.005",
"execute_price": "max(orderbook().ask[0].price-symbol().price_precision,min_ask_price)*(1+gap*(order_pos-1))",
"min_ask_price": "orderbook().bid[0].price+symbol().price_precision",
"execute_volume": "10/execute_price+abs(order_pos)*10/execute_price",
"buy_orders_count": "0",
"sell_orders_count": "5 if balance('counter').total < 5000 else 0"
}
```

</details>

<details>

<summary>Grid 2: <a href="/pages/3BLMvaxDCOVV6jVANuz8">Selling at the Best Price Considering Historical Data</a></summary>

```json
{
"gap": "0.01",
"candles_1d": "candles('d1', 'base-counter',count=30)",
"execute_price": "max(orderbook().ask[0].price-symbol().price_precision,(month_mean_high+month_mean_close)/2,min_ask_price)*(1+gap*(order_pos-1))",
"min_ask_price": "max(month_mean_close,orderbook().bid[0].price+symbol().price_precision*2)",
"execute_volume": "10/execute_price if execute_price<month_mean_high else (10/execute_price+abs(order_pos)*10/execute_price)",
"month_mean_high": "mean([price.high for price in candles_1d])",
"buy_orders_count": "0",
"month_mean_close": "mean([price.close for price in candles_1d])",
"sell_orders_count": "5 if balance('counter').total < 5000 else 0"
}
```

</details>

<details>

<summary>Grid 3: <a href="/pages/9dsQop0t4wxMYgSNhInX">Buying at the Best Price with Maximum Price and Balance Constraints</a></summary>

```json
{
"gap": "0.005",
"execute_price": "min(orderbook().bid[0].price+symbol().price_precision,max_bid_price)*(1+gap*(order_pos+1))",
"max_bid_price": "orderbook().ask[0].price-symbol().price_precision",
"execute_volume": "10/execute_price+abs(order_pos)*10/execute_price",
"buy_orders_count": "5 if balance('counter').total > 5000 else 0",
"sell_orders_count": "0"
}
```

</details>

<details>

<summary>Grid 4: <a href="/pages/8TZAFR1EHXYmqJuBPd6D">Buying at the Best Price Considering Historical Data</a></summary>

```json
{
"gap": "0.01",
"candles_1d": "candles('d1', 'base-counter',count=30)",
"execute_price": "min(orderbook().bid[0].price+symbol().price_precision,(month_mean_low+month_mean_close)/2,max_bid_price)*(1+gap*(order_pos+1))",
"max_bid_price": "min(month_mean_close,orderbook().ask[0].price-symbol().price_precision*2)",
"execute_volume": "10/execute_price if execute_price>month_mean_low else (10/execute_price+abs(order_pos)*10/execute_price)",
"month_mean_low": "mean([price.low for price in candles_1d])",
"buy_orders_count": "5 if balance('counter').total > 5000 else 0",
"month_mean_close": "mean([price.close for price in candles_1d])",
"sell_orders_count": "0"
}
```

</details>

<details>

<summary>Grid 5: <a href="/pages/zQGCJYeDBl4RCFcpPJqa">Placing Orders at the Best Price or with a Minimum Spread</a></summary>

```json
{
"gap": "0.005",
"min_spread": "0.02",
"pivot_price": "(orderbook().ask[0].price+orderbook().bid[0].price+ticker())/3",
"execute_price": "(pivot_price*(1-min_spread/2+(order_pos+1)*gap) if pivot_price*(1-min_spread/2)<=(orderbook().bid[0].price+symbol().price_precision) else min(orderbook().bid[0].price + symbol().price_precision,orderbook().ask[0].price - symbol().price_precision)*(1+gap*(order_pos+1))) if side=='buy' else (pivot_price*(1+min_spread/2+(order_pos-1)*gap) if pivot_price*(1+min_spread/2)>=(orderbook().ask[0].price-symbol().price_precision) else max(orderbook().ask[0].price - symbol().price_precision,orderbook().bid[0].price + symbol().price_precision)*(1+gap*(order_pos-1)))",
"execute_volume": "20/execute_price + 0 * abs(order_pos)/execute_price",
"buy_orders_count": "5",
"sell_orders_count": "5"
}
```

</details>

<details>

<summary>Grid 6: <a href="/pages/3IxjvIlPsz2ExUQ2uGZA">Placing Orders with a Spread Based on Historical Data</a></summary>

```json
{
"gap_ask": "0.005",
"gap_bid": "0.005",
"price_ask": "max(orderbook().ask[0].price-symbol().price_precision,(two_weeks_mean_high+two_weeks_mean_close)/2,mean_high_15m,min_ask_price)",
"price_bid": "min(orderbook().bid[0].price+symbol().price_precision,(two_weeks_mean_low+two_weeks_mean_close)/2,mean_low_15m,max_bid_price)",
"candles_1d": "candles('d1', 'base-counter',count=14)",
"spread_min": "10*symbol().price_precision",
"candles_15m": "candles('m15','base-counter')",
"mean_low_15m": "mean([price.low for price in candles_15m])",
"execute_price": "(((price_bid+price_ask)/2-spread_min/2)*(1+gap_bid*(order_pos+1)) if side=='buy' else ((price_bid+price_ask)/2+spread_min/2)*(1+gap_ask*(order_pos-1))) if (price_ask-price_bid)<spread_min else (price_bid*(1+gap_bid*(order_pos+1)) if side=='buy' else price_ask*(1+gap_ask*(order_pos-1)))",
"max_bid_price": "mean_low_15m",
"mean_high_15m": "mean([price.high for price in candles_15m])",
"min_ask_price": "mean_high_15m",
"execute_volume": "(6/execute_price if execute_price>two_weeks_mean_low else 10 / execute_price * abs(order_pos)) if side=='buy' else (6/execute_price if execute_price<two_weeks_mean_high else 10 / execute_price * abs(order_pos))",
"buy_orders_count": "5",
"sell_orders_count": "5",
"two_weeks_mean_low": "mean([price.low for price in candles_1d])",
"two_weeks_mean_high": "mean([price.high for price in candles_1d])",
"two_weeks_mean_close": "mean([price.close for price in candles_1d])"
}
```

</details>

<details>

<summary>Grid 7: <a href="/pages/ffGQ6IqP5lkTSxrfUJzw">Placing Buy and Sell Orders Based on RSI of 15-Minute Candlesticks</a></summary>

```json
{
  "gap": "0.005",
  "min_low": "orderbook().bid[0].price",
  "max_high": "orderbook().ask[0].price",
  "price_low": "min(rsi_to_price(candles_15m, rsi_expected=40), orderbook().ask[0].price, min_low)",
  "price_high": "max(rsi_to_price(candles_15m, rsi_expected=60), orderbook().bid[0].price, max_high)",
  "candles_15m": "candles('m15')",
  "execute_price": "(price_low if side == 'buy' else price_high) * ( 1 + gap * order_pos)",
  "execute_volume": "cached(60, respect='order_pos')(10/execute_price *abs(order_pos))",
  "buy_orders_count": "5",
  "sell_orders_count": "5",
  "sleep_after_seconds": "900"
}
```

</details>

<details>

<summary>Grid 8: <a href="/pages/MKWcP780qWKtGxShfcUk">Buying and Selling When the 15-Minute RSI Exits a Defined Range</a></summary>

```json
{
  "max_bid": "mean([candle.close for candle in candles_m15])",
  "min_ask": "mean([candle.close for candle in candles_m15])",
  "rsi_m15": "rsi(candles('m15', 'base-counter'), period=14, column='close')[0]",
  "candles_m15": "candles('m15', 'base-counter')",
  "execute_price": "min(orderbook().ask[0].price,max_bid) if side == 'buy' else max(orderbook().bid[0].price,min_ask)",
  "execute_volume": "10 / ticker()",
  "buy_orders_count": "1 if rsi_m15 < 30 else 0",
  "sell_orders_count": "1 if rsi_m15 > 70 else 0",
  "sleep_after_seconds": "300"
}
```

</details>


# Selling at the Best Price with Minimum Price and Balance Constraints

Learn to configure Origami Tech grid strategies to sell assets at optimal prices while maintaining defined balance and price constraints.

&#x20;Grid 1: Selling at the Best Price with Minimum Price and Balance Constraints

```json
{
"gap": "0.005",
"execute_price": "max(orderbook().ask[0].price-symbol().price_precision,min_ask_price)*(1+gap*(order_pos-1))",
"min_ask_price": "orderbook().bid[0].price+symbol().price_precision",
"execute_volume": "10/execute_price+abs(order_pos)*10/execute_price",
"buy_orders_count": "0",
"sell_orders_count": "5 if balance('counter').total < 5000 else 0"
}
```

**The grid places sell orders at the best price.**\
An additional parameter, **gap**, is used to calculate the order prices. In this example, it is set to **0.5%**, and the price increment is calculated as: <mark style="color:red;">`1+gap*(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`-1)`</mark>

<mark style="color:red;">`min_ask_price`</mark> in this case :

<mark style="color:red;">`orderbook().bid[0].price+symbol().price_precision`</mark>

**Sets the minimum sell price to 1 price\_precision above the best bid.**\
A specific number can also be used as a constraint.

* **execute\_volume**: Sets the order volume in **Base** tokens.
  * For the first order, the volume corresponds to **20 Counter tokens**.
  * For each subsequent order, the volume increments by **10 Counter tokens**.

<figure><img src="/files/AVQCNTkiTlz1f5E9F6no" alt=""><figcaption></figcaption></figure>

<mark style="color:red;">`10/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)<mark style="color:red;">`+`</mark>[<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)*10/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)

Orders will be placed until the balance of the Counter token exceeds 5000.

<figure><img src="/files/ZTRxYsmimvgwhikBRbV4" alt=""><figcaption></figcaption></figure>

<mark style="color:red;">`group_balance('counter').current.total`</mark>

<mark style="color:red;">`5 if group_balance('counter').current.total < 5000 else 0`</mark>

or based on the token balanc&#x65;**.** <mark style="color:red;">`base balance('base').total`</mark>

<mark style="color:red;">`5 if balance('base').total > 5000 else 0`</mark>


# Selling at the Best Price Considering Historical Data

Learn how to configure Origami Tech grid strategies that optimize sell orders based on historical data analysis and performance tracking.

[Grid 2: Selling at the Best Price Considering Historical Data](/user-guide/grids-examples#grid-2-prodazha-po-luchshei-cene-s-uchetom-istoricheskikh-dannykh)

Selling at the best price, not lower than `min_ask_price` and the midpoint between the average closing price and the average highs of daily candles over the past month.

```json
{
"gap": "0.01",
"candles_1d": "candles('d1', 'base-counter',count=30)",
"execute_price": "max(orderbook().ask[0].price-symbol().price_precision,(month_mean_high+month_mean_close)/2,min_ask_price)*(1+gap*(order_pos-1))",
"min_ask_price": "max(month_mean_close,orderbook().bid[0].price+symbol().price_precision*2)",
"execute_volume": "10/execute_price if execute_price<month_mean_high else (10/execute_price+abs(order_pos)*10/execute_price)",
"month_mean_high": "mean([price.high for price in candles_1d])",
"buy_orders_count": "0",
"month_mean_close": "mean([price.close for price in candles_1d])",
"sell_orders_count": "5 if balance('counter').total < 5000 else 0"
}
```

The grid places sell orders at the best price. An additional parameter, <mark style="color:red;">**`gap`**</mark>, is used to calculate the order prices. In this example, it is set to **1%**.

<mark style="color:red;">`1+gap*(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`-1)`</mark>

As additional parameters, daily candles for the last 30 days are retrieved.

[`candles`](/function/functions/candles)<mark style="color:red;">`('d1', '`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`',count=30)`</mark>

Based on these, additional parameters are calculated: the average closing price and the average daily high price over the last 30 days.

[<mark style="color:blue;">`mean`</mark>](/function/functions/mean)<mark style="color:red;">`([price.`</mark>[<mark style="color:blue;">`close`</mark>](/function/structures/candle) <mark style="color:red;">`for price in candles_1d])`</mark>

[<mark style="color:blue;">`mean`</mark>](/function/functions/mean)<mark style="color:red;">`([price.`</mark>[<mark style="color:blue;">`high`</mark>](/function/structures/candle) <mark style="color:red;">`for price in candles_1d])`</mark>

<figure><img src="/files/qeezec3bt3kYXh6oHyvP" alt=""><figcaption></figcaption></figure>

Next, the order price is calculated as the maximum of the current best price, the minimum ask price set in the <mark style="color:red;">`min_ask_price`</mark> parameter, and the midpoint between the average closing price and the average high price over the last 30 days.

In this example, <mark style="color:red;">`min_ask_price`</mark> is set to the maximum of the average closing price and the current best bid price, plus 2 price\_precision.

Orders will be placed until the balance of the **Counter** token exceeds 5000.\
If needed, this can be replaced with a combined balance across multiple exchanges.

[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total`</mark>

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total < 5000 else 0`</mark>

or based on the token balance <mark style="color:red;">`base`</mark> [<mark style="color:blue;">`balance`</mark>](/function/structures/balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').total`</mark>

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`balance`</mark>](/function/structures/balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').total > 5000 else 0`</mark>


# Buying at the Best Price with Maximum Price and Balance Constraints

Learn how to create Origami Tech grid strategies that execute buy orders efficiently while respecting price and balance limitations.

Buying at the best price with a cap on maximum buy price and current counter token balance

```json
{
"gap": "0.005",
"execute_price": "min(orderbook().bid[0].price+symbol().price_precision,max_bid_price)*(1+gap*(order_pos+1))",
"max_bid_price": "orderbook().ask[0].price-symbol().price_precision",
"execute_volume": "10/execute_price+abs(order_pos)*10/execute_price",
"buy_orders_count": "5 if balance('counter').total > 5000 else 0",
"sell_orders_count": "0"
}
```

The grid places buy orders at the best available price. An additional parameter, gap, is used in calculating the order prices. In this example, gap is set to 0.5%.

<mark style="color:red;">`1+gap*(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`-1)`</mark>

<mark style="color:red;">`max_bid_price`</mark>parameter in this case is defined as:

<mark style="color:red;">`orderbook().ask[0].price-symbol().price_precision`</mark>

which sets the maximum buy price to one price\_precision below the best ask price. Alternatively, a specific numerical value can be used to set the limit.

The [<mark style="color:blue;">`execute_volume`</mark>](/function/required-parameters/execute-volume) parameter determines the base token amount, equivalent to 20 counter tokens for the first order, with an increment of 10 counter tokens for each subsequent order. The formula used is:&#x20;

<mark style="color:red;">`10/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)<mark style="color:red;">`+`</mark>[<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)*10/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)

Orders will continue to be placed until the balance of the <mark style="color:red;">`counter`</mark> token drops below 5000.

If needed, this limitation can be replaced with the aggregated balance across multiple exchanges [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('counter').current.total`</mark>

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('counter').current.total > 5000 else 0`</mark>

&#x20;or with the balance of the base token, defined as: [<mark style="color:blue;">`balance`</mark>](/function/functions/balance)<mark style="color:red;">`('base').total`</mark>

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`balance`</mark>](/function/functions/balance)<mark style="color:red;">`('base').total < 5000 else 0`</mark>


# Buying at the Best Price Considering Historical Data

Configure grid trading in Origami Tech to optimize buy orders using historical data patterns and backtested performance insights.

```json
{
"gap": "0.01",
"candles_1d": "candles('d1', 'base-counter',count=30)",
"execute_price": "min(orderbook().bid[0].price+symbol().price_precision,(month_mean_low+month_mean_close)/2,max_bid_price)*(1+gap*(order_pos+1))",
"max_bid_price": "min(month_mean_close,orderbook().ask[0].price-symbol().price_precision*2)",
"execute_volume": "10/execute_price if execute_price>month_mean_low else (10/execute_price+abs(order_pos)*10/execute_price)",
"month_mean_low": "mean([price.low for price in candles_1d])",
"buy_orders_count": "5 if balance('counter').total > 5000 else 0",
"month_mean_close": "mean([price.close for price in candles_1d])",
"sell_orders_count": "0"
}
```

Buy orders are placed at the best available price, provided it does not exceed the max\_bid\_price or the midpoint between the average closing price and the average daily low over the past month.

The grid places buy orders at the best price, with an additional parameter, gap, used to calculate the order prices. In this example, the gap is set to 1%.

Price reduction: <mark style="color:red;">`1+gap*(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`+1)`</mark>

As supplementary parameters, daily candlestick data for the past 30 days is retrieved:

[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`('d1', '`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`',count=30)`</mark>

Based on this data, the following additional parameters are calculated:

Average closing price over 30 days:

[<mark style="color:blue;">`mean`</mark>](/function/functions/mean)<mark style="color:red;">`([price.close for price in candles_1d])`</mark>

Average daily low over 30 days:

[<mark style="color:blue;">`mean`</mark>](/function/functions/mean)<mark style="color:red;">`([price.low for price in candles_1d])`</mark>

The order price is then determined as the maximum of:

* The current best bid.
* The maximum bid price: max\_bid\_price. In this case minimum of the current best ask price minus two price\_precision and average closing price over 30 days.
* The midpoint between the average closing price and the average daily low over the past 30 days.

Orders will be placed until the counter token balance exceeds 5000

If needed, this restriction can be replaced with the aggregated balance across multiple exchanges:

[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total`</mark>

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total < 5000 else 0`</mark>

or the base token balance

<mark style="color:red;">`5 if`</mark> [<mark style="color:blue;">`balance`</mark>](/function/functions/balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').total < 5000 else 0`</mark>


# Placing Orders at the Best Price or with a Minimum Spread

Explore how to configure grid strategies in Origami Tech that place orders efficiently using optimal pricing or minimum spread constraints.

Orders are placed either with a spread around the current price or at the best price if the spread exceeds the minimum set value.

```json
{
"gap": "0.005",
"min_spread": "0.02",
"pivot_price": "(orderbook().ask[0].price+orderbook().bid[0].price+ticker())/3",
"execute_price": "(pivot_price*(1-min_spread/2+(order_pos+1)*gap) if pivot_price*(1-min_spread/2)<=(orderbook().bid[0].price+symbol().price_precision) else min(orderbook().bid[0].price + symbol().price_precision,orderbook().ask[0].price - symbol().price_precision)*(1+gap*(order_pos+1))) if side=='buy' else (pivot_price*(1+min_spread/2+(order_pos-1)*gap) if pivot_price*(1+min_spread/2)>=(orderbook().ask[0].price-symbol().price_precision) else max(orderbook().ask[0].price - symbol().price_precision,orderbook().bid[0].price + symbol().price_precision)*(1+gap*(order_pos-1)))",
"execute_volume": "20/execute_price + 0 * abs(order_pos)/execute_price",
"buy_orders_count": "5",
"sell_orders_count": "5"
}
```

In this example, the order price is determined as the average of three values:

* The last market trade.
* The best ask price.
* The best bid price.

<mark style="color:red;">`(`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().ask[0].price +`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().bid[0].price +`</mark>[<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`())/3`</mark>

Orders are then placed either at the best price or with a 2% spread if the current spread is smaller.

The price increment is defined as `(`[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos) `+ 1) * gap` for bids and `(`[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos) `- 1) * gap` for asks, where gap is set to 0.5%.

Each order is placed for the equivalent of 20 counter tokens without increasing the volume for subsequent orders. To enable volume increments, replace 0 with the desired increment value.

<mark style="color:red;">`20/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) <mark style="color:red;">`+ 0 *`</mark> [<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)


# Placing Orders with a Spread Based on Historical Data

Learn how to create Origami grid strategies that adjust spreads dynamically based on historical volatility and price performance.

Orders are placed at the best price within a defined spread, ensuring asks are not set below, and bids not set above, historical price levels.

```json
{
"gap_ask": "0.005",
"gap_bid": "0.005",
"price_ask": "max(orderbook().ask[0].price-symbol().price_precision,(two_weeks_mean_high+two_weeks_mean_close)/2,mean_high_15m,min_ask_price)",
"price_bid": "min(orderbook().bid[0].price+symbol().price_precision,(two_weeks_mean_low+two_weeks_mean_close)/2,mean_low_15m,max_bid_price)",
"candles_1d": "candles('d1', 'base-counter',count=14)",
"spread_min": "10*symbol().price_precision",
"candles_15m": "candles('m15','base-counter')",
"mean_low_15m": "mean([price.low for price in candles_15m])",
"execute_price": "(((price_bid+price_ask)/2-spread_min/2)*(1+gap_bid*(order_pos+1)) if side=='buy' else ((price_bid+price_ask)/2+spread_min/2)*(1+gap_ask*(order_pos-1))) if (price_ask-price_bid)<spread_min else (price_bid*(1+gap_bid*(order_pos+1)) if side=='buy' else price_ask*(1+gap_ask*(order_pos-1)))",
"max_bid_price": "mean_low_15m",
"mean_high_15m": "mean([price.high for price in candles_15m])",
"min_ask_price": "mean_high_15m",
"execute_volume": "(6/execute_price if execute_price>two_weeks_mean_low else 10 / execute_price * abs(order_pos)) if side=='buy' else (6/execute_price if execute_price<two_weeks_mean_high else 10 / execute_price * abs(order_pos))",
"buy_orders_count": "5",
"sell_orders_count": "5",
"two_weeks_mean_low": "mean([price.low for price in candles_1d])",
"two_weeks_mean_high": "mean([price.high for price in candles_1d])",
"two_weeks_mean_close": "mean([price.close for price in candles_1d])"
}
```

In this example, the following additional data is used:

* 100 fifteen-minute candlesticks: [<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`('m15','`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`')`</mark>.
* 14 daily candlesticks: [<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`('d1','`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`',count=14)`</mark>.

#### Ask Price Calculation

The ask price is determined as the maximum of:

* The best ask price minus [<mark style="color:blue;">`symbol`</mark>](/function/functions/symbol)<mark style="color:red;">`().price_precision`</mark>.
* The average high price of 100 fifteen-minute candlesticks (<mark style="color:red;">`mean_high_15m`</mark>).
* The minimum ask price (<mark style="color:red;">`min_ask_price`</mark>). In example it equal to <mark style="color:red;">`mean_high_15m`</mark>. If required, it can be replaced with a specific number or any other value.
* The midpoint between the average closing price and the average high price of the last two weeks' daily candlesticks.

[<mark style="color:blue;">`max`</mark>](/function/functions/max)<mark style="color:red;">`(`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().ask[0].price-`</mark>[<mark style="color:blue;">`symbol`</mark>](/function/functions/symbol)<mark style="color:red;">`().price_precision,(two_weeks_mean_high+two_weeks_mean_close)/2,mean_high_15m,min_ask_price)`</mark>

#### Bid Price Calculation

The bid price is determined as the minimum of:

* The best bid price plus [<mark style="color:blue;">`symbol`</mark>](/function/functions/symbol)<mark style="color:red;">`().price_precision`</mark>
* The average low price of 100 fifteen-minute candlesticks (<mark style="color:red;">`mean_low_15m`</mark>)
* The maximum bid price (<mark style="color:red;">`max_bid_price`</mark>). In example it equal to <mark style="color:red;">`mean_low_15m`</mark>. If required, it can be replaced with a specific number or any other value.
* The midpoint between the average closing price and the average low price of the last two weeks' daily candlesticks.

[<mark style="color:blue;">`min`</mark>](/function/functions/min)<mark style="color:red;">`(`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().bid[0].price+`</mark>[<mark style="color:blue;">`symbol`</mark>](/function/functions/symbol)<mark style="color:red;">`().price_precision,(two_weeks_mean_low+two_weeks_mean_close)/2,mean_low_15m,max_bid_price)`</mark>

#### Spread and Price Adjustment

If the spread between the calculated price\_ask and price\_bid is smaller than the parameter spread\_min (set to 10 [<mark style="color:blue;">`symbol`</mark>](/function/functions/symbol)<mark style="color:red;">`().price_precision`</mark>), orders are adjusted to meet the minimum spread.

Otherwise:

Asks are placed at price\_ask with a 0.5% increment (<mark style="color:red;">`gap_ask`</mark>). Bids are placed at price\_bid with a 0.5% increment (<mark style="color:red;">`gap_bid`</mark>).

#### Order Volume Calculation

Order volume is set without increments and equals the equivalent of 6 counter tokens if the order price within the range of the average low and average high prices of two weeks' daily candlesticks.

For orders outside this range, the volume increases as the equivalent of 10 counter tokens multiplied by the order number.

<mark style="color:red;">`(6/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) <mark style="color:red;">`if`</mark> [<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)<mark style="color:red;">`>two_weeks_mean_low else 10 /`</mark> [<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) <mark style="color:red;">`*`</mark> [<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)) if`</mark> [<mark style="color:blue;">`side`</mark>](/function/pre-defined-parameters#side-string)<mark style="color:red;">`=='`</mark>[<mark style="color:blue;">`buy`</mark>](/function/pre-defined-parameters)<mark style="color:red;">`' else (6/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) <mark style="color:red;">`if`</mark> [<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)<mark style="color:red;">`<two_weeks_mean_high else 10 /`</mark> [<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) <mark style="color:red;">`*`</mark> [<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`))`</mark>


# Placing Buy and Sell Orders Based on RSI of 15-Minute Candlesticks

Explore an Origami Tech example showing how to place automated buy and sell orders based on RSI signals from 15-minute candlestick data.

Orders are placed at levels corresponding to an RSI of 40 for buy orders and an RSI of 60 for sell orders, or at the best bid or ask price if the RSI moves outside the specified range.

```json
{
  "gap": "0.005",
  "min_low": "orderbook().bid[0].price",
  "max_high": "orderbook().ask[0].price",
  "price_low": "min(rsi_to_price(candles_15m, rsi_expected=40), orderbook().ask[0].price, min_low)",
  "price_high": "max(rsi_to_price(candles_15m, rsi_expected=60), orderbook().bid[0].price, max_high)",
  "candles_15m": "candles('m15')",
  "execute_price": "(price_low if side == 'buy' else price_high) * ( 1 + gap * order_pos)",
  "execute_volume": "cached(60, respect='order_pos')(10/execute_price *abs(order_pos))",
  "buy_orders_count": "5",
  "sell_orders_count": "5",
  "sleep_after_seconds": "900"
}
```

In this example, 15-minute candlestick data is used to estimate the price levels that would correspond to an RSI of 40 and 60 in the next period.

[<mark style="color:blue;">`rsi_to_price`</mark>](/function/technical-analysis/rsi-to-price)<mark style="color:red;">`(candles_15m, rsi_expected=40)`</mark>

[<mark style="color:blue;">`rsi_to_price`</mark>](/function/technical-analysis/rsi-to-price)<mark style="color:red;">`(candles_15m, rsi_expected=60)`</mark>

Bids are placed at RSI 40, and asks are placed at RSI 60 with a price increment of 0.5%, which is defined in the parameter "gap".

Buy orders are placed at the RSI 40 level. Sell orders are placed at the RSI 60 level. A price increment is 0.5%, as specified by the gap parameter.

The volume for each order is calculated as the equivalent of 10 counter tokens multiplied by the order's sequence number.

<mark style="color:red;">`10/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) <mark style="color:red;">`*`</mark>[<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)`</mark>

The order grid is updated every 15 minutes.

<mark style="color:red;">`"`</mark>[<mark style="color:blue;">`sleep_after_seconds`</mark>](/function/optional-parameters/sleep-after-seconds)<mark style="color:red;">`": "900"`</mark>


# Buying and Selling When the 15-Minute RSI Exits a Defined Range

Explore an Origami Tech grid example using RSI-based triggers to automate buy and sell orders when indicators exit defined thresholds.

Execute buy and sell orders when the 15-minute RSI moves outside the specified range of values.

```json
{
  "max_bid": "mean([candle.close for candle in candles_m15])",
  "min_ask": "mean([candle.close for candle in candles_m15])",
  "rsi_m15": "rsi(candles('m15', 'base-counter'), period=14, column='close')[0]",
  "candles_m15": "candles('m15', 'base-counter')",
  "execute_price": "min(orderbook().ask[0].price,max_bid) if side == 'buy' else max(orderbook().bid[0].price,min_ask)",
  "execute_volume": "10 / ticker()",
  "buy_orders_count": "1 if rsi_m15 < 30 else 0",
  "sell_orders_count": "1 if rsi_m15 > 70 else 0",
  "sleep_after_seconds": "300"
}
```

Buy Orders: Triggered when the RSI falls below 30, executed at the first ask price.&#x20;

Sell Orders: Triggered when the RSI rises above 70, executed at the first bid price.

In this example, 15-minute candlestick data is used to calculate the average closing price

[<mark style="color:blue;">`mean`</mark>](/function/functions/mean)<mark style="color:red;">`([candle.`</mark>[<mark style="color:blue;">`close`</mark>](/function/structures/candle) <mark style="color:red;">`for candle in candles_m15])`</mark>

and the RSI

[<mark style="color:blue;">`rsi`</mark>](/function/technical-analysis/stochastic-rsi)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`('m15', '`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`'), period=14, column='`</mark>[<mark style="color:blue;">`close`</mark>](/function/structures/candle)<mark style="color:red;">`')[0]`</mark>

Sell Orders:

If the RSI exceeds 70, a sell order is placed every 300 seconds (as specified by <mark style="color:red;">`"`</mark>[<mark style="color:blue;">`sleep_after_seconds`</mark>](/function/optional-parameters/sleep-after-seconds)<mark style="color:red;">`": "300"`</mark>) at the best bid price, provided it is not lower than the average closing price of the last 100 fifteen-minute candlesticks.

<mark style="color:red;">`"`</mark>[<mark style="color:blue;">`sell_orders_count`</mark>](/function/required-parameters/sell-orders-count)<mark style="color:red;">`": "1 if rsi_m15 > 70 else 0"`</mark>

Buy Orders:

If the RSI falls below 30, a buy order is placed every 300 seconds at the best ask price, provided it is not higher than the average closing price of the last 100 fifteen-minute candlesticks.

<mark style="color:red;">`"`</mark>[<mark style="color:blue;">`buy_orders_count`</mark>](/function/required-parameters/buy-orders-count)<mark style="color:red;">`": "1 if rsi_m15 < 30 else 0"`</mark>


# Required parameters

Essential parameters that must be configured for the grid to function correctly.

<table data-header-hidden data-full-width="true"><thead><tr><th width="340"></th><th></th></tr></thead><tbody><tr><td><h2><a href="/pages/x85yQo4Rv2SxDgkSOG3w"><mark style="color:blue;"><code>buy_orders_count</code></mark></a></h2></td><td>Responsible for the number of buy orders placed.</td></tr><tr><td><h2><a href="#sell_orders_count-integer-or-formula-greater-than-integer"><mark style="color:blue;"><code>sell_orders_count</code></mark></a></h2></td><td>Responsible for the number of sell orders placed.</td></tr><tr><td><h2><a href="/pages/oRWHlqsXiv1WwNDo6C2R"><mark style="color:blue;"><code>execute_price</code></mark></a></h2></td><td>Determines the price of the orders being placed.</td></tr><tr><td><h2><a href="/pages/yiZ5JRS6cdToVh7DT97J"><mark style="color:blue;"><code>execute_volume</code></mark></a></h2></td><td>Specifies the amount to be placed, denominated in the base token.</td></tr></tbody></table>

<details>

<summary>An example of a simple grid</summary>

The grid will place two sell orders and two buy orders, each with a 0.5% increment from the current market price. The order amount will be 10 divided by the current market price.

```json
{
    "execute_price": "ticker()*(1+0.005*order_pos)",
    "execute_volume": "10/ticker()",
    "buy_orders_count": "2",
    "sell_orders_count": "2"
}
```

</details>


# Buy Orders Count

The parameter responsible for the number of buy orders placed.

## <mark style="color:purple;">`buy_orders_count`</mark> \[*integer* | *formula* -> \[*integer*]]

Non-negative number of <mark style="color:red;">`side=’`</mark>[<mark style="color:blue;">`buy`</mark>](/function/pre-defined-parameters/side)<mark style="color:red;">`’`</mark> orders to place. Accepts values of integer and decimal types. It is possible to use <mark style="color:red;">`formula`</mark> as value.  If-else logic is also supported. When using float values, they are rounded down to the nearest whole number.

<details>

<summary>Example:</summary>

2 buy orders will be placed.

<mark style="color:red;">`"buy_orders_count": "2"`</mark>

***

5 buy orders will be placed if the current total base token balance less than 5000.

<mark style="color:red;">`"buy_orders_count": "5 if`</mark> [<mark style="color:blue;">`balance`</mark>](/function/structures/balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts#base)<mark style="color:red;">`').total < 5000 else 0"`</mark>

```
5 if balance('base').total < 5000 else 0
```

***

5 buy orders will be placed if the current total counter token group balance exceeds 5000.

<mark style="color:red;">`"buy_orders_count": "5 if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total > 5000 else 0"`</mark>

```
5 if group_balance('counter').current.total > 5000 else 0
```

***

A buy order will be placed if the current total base token group balance is lower than the starting one and the first ask price is lower than the fair price, which is calculated based on the ratio of the differences in the starting and current balances of the base token and counter token.

<mark style="color:red;">`"buy_orders_count": "1 if`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().ask[0].price < (`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').start.total -`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').current.total)/(`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total -`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').start.total) and`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').start.total >`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').current.total else 0"`</mark>

```
1 if orderbook().ask[0].price < (group_balance('base').start.total-group_balance('base').current.total)/(group_balance('counter').current.total-group_balance('counter').start.total) and group_balance('base').start.total > group_balance('base').current.total else 0
```

***

Random number of buy order will be placed in range \[0, 10], rounded down.

<mark style="color:red;">`"buy_orders_count": "`</mark>[<mark style="color:blue;">`random`</mark>](/function/functions/random)<mark style="color:red;">`() * 10"`</mark>

```
random() * 10
```

</details>


# Sell Orders Count

The parameter responsible for the number of sell orders placed.

## <mark style="color:purple;">`sell_orders_count`</mark> \[*integer* | *formula* -> \[*integer*]]

Non-negative number of <mark style="color:red;">`side=’`</mark>[`sell`](/function/pre-defined-parameters/side)<mark style="color:red;">`’`</mark> orders to place. Accepts values of integer and decimal types. It is possible to use <mark style="color:red;">`formula`</mark> as value. Supports if-else logic. When using float values, they are rounded down to the nearest whole number.

<details>

<summary>Example:</summary>

2 sell orders will be placed.

<mark style="color:red;">`"sell_orders_count": "2"`</mark>

***

5 sell orders will be placed if the current total base token group balance exceeds 5000.

<mark style="color:red;">`"sell_orders_count": "5 if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts#base)<mark style="color:red;">`').current.total > 5000 else 0"`</mark>

```
5 if group_balance ('base').current.total > 5000 else 0
```

***

5 sell orders will be placed if the current total counter token balance less than 5000.

<mark style="color:red;">`"sell_orders_count": "5 if`</mark> [<mark style="color:blue;">`balance`</mark>](/function/structures/balance)<mark style="color:red;">`('counter').total < 5000 else 0"`</mark>

```
5 if balance('counter').total < 5000 else 0
```

***

A sell order will be placed if the current total counter token group balance is lower than the starting one and the first bid price is higher than the fair price, which is calculated based on the ratio of the differences in the starting and current balances of the base token and counter token.

<mark style="color:red;">`"sell_orders_count": "1 if`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().bid[0].price > (`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').current.total -`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').start.total)/(`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').start.total -`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total) and`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').start.total >`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total else 0"`</mark>

```
1 if orderbook().bid[0].price > (group_balance('base').current.total - group_balance('base').start.total) / (group_balance('counter').start.total - group_balance('counter').current.total) and group_balance('counter').start.total > group_balance('counter').current.total else 0
```

***

Random number of sell orders will be placed in range \[0, 10], rounded down.

<mark style="color:red;">`"sell_orders_count": "`</mark>[<mark style="color:blue;">`random`</mark>](/function/functions/random)<mark style="color:red;">`() * 10"`</mark>

```
random() * 10
```

</details>


# Execute Price

The parameter that determines the price of the orders being placed.

## <mark style="color:purple;">`execute_price`</mark> \[*decimal* | *formula* -> \[*decimal*]]

The price value for each order in the grid. It accepts both integer and decimal inputs and allows the use of formulas as values. If-else logic is supported. Use the [`buy`](/function/pre-defined-parameters/side) or [`sell`](/function/pre-defined-parameters/side) side to configure buy and sell orders within a single grid.

{% hint style="danger" %}
Always positive value. Can’t be zero.
{% endhint %}

{% hint style="info" %}
Supports the use of the iterable parameter [`order_pos`](/function/pre-defined-parameters/order-pos) to facilitate the placement of multiple orders.
{% endhint %}

{% hint style="danger" %}
[<mark style="color:blue;">`execute_volume`</mark>](/function/required-parameters/execute-volume) can't be used in <mark style="color:purple;">`execute_price`</mark> .
{% endhint %}

<details>

<summary>Example:</summary>

The order will be placed at a price of 2345.95.

<mark style="color:red;">`"execute_price": "2345.95"`</mark>

***

The order will be executed at the current market price.

<mark style="color:red;">`"execute_price": "`</mark>[<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`()"`</mark>

```
ticker()
```

***

The order will be placed at the first market bid price.

<mark style="color:red;">`"execute_price": "`</mark>[<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().bid[0].price"`</mark>

```
orderbook().bid[0].price
```

***

The order will be executed at the first ask price.

<mark style="color:red;">`"execute_price": "`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().ask[0].price"`</mark>

```
orderbook().ask[0].price
```

***

The order will be placed at the arithmetic average of the bid and ask prices for Bybit's ETH-USDT pair.

<mark style="color:red;">`"execute_price": "(`</mark>[<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`('ETH-USDT','bybit').bid[0].price +`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`('EVER-USDT','bybit').ask[0].price) / 2"`</mark>

```
(orderbook('ETH-USDT','bybit').bid[0].price + orderbook('EVER-USDT','bybit').ask[0].price) / 2
```

***

The order will be executed at the current market price if the starting total base matches the current total base. Otherwise, it will be placed at the fair price, determined by the ratio of the differences between the starting and current balances of the base and counter tokens.

<mark style="color:red;">`"execute_price": "`</mark>[<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`() if`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').current.total ==`</mark> [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').start.total else (`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').start.total -`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').current.total)/(`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').current.total -`</mark>[<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)<mark style="color:red;">`('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`').start.total)"`</mark>

```
ticker() if group_balance('counter').current.total == group_balance('counter').start.total else (group_balance('base').start.total-group_balance('base').current.total)/(group_balance('counter').current.total-group_balance('counter').start.total)
```

***

The orders will be placed at the price of the first market ask for sell orders and the first market bid for buy orders, adjusted by ±0.5%, respectively. Subsequent orders will be placed at increments of 0.5% of the price for each additional order.

<mark style="color:red;">`"execute_price": "(`</mark> [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().bid[0].price if side==’`</mark>[<mark style="color:blue;">`buy`</mark>](/function/pre-defined-parameters/side)<mark style="color:red;">`’ else`</mark>  [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().ask[0].price) * (1 + 0.005 *`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)"`</mark>

```
(orderbook().bid[0].price if side==’buy’ else orderbook().ask[0].price) * (1 + 0.005 * order_pos)
```

***

Orders will be placed at the price level where the RSI is anticipated to reach 60 on 15-minute candlesticks.

<mark style="color:red;">`"execute_price": "`</mark>[<mark style="color:blue;">`rsi_to_price`</mark>](/function/technical-analysis/rsi-to-price)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`(’m15’), rsi_expected=60)"`</mark>

```
rsi_to_price(candles(’m15’), rsi_expected=60)
```

***

Place an order at the average closing price of the most recent 100 fifteen-minute candlesticks.

<mark style="color:red;">`"execute_price": "`</mark>[<mark style="color:blue;">`mean`</mark>](/function/functions/mean)<mark style="color:red;">`([candle.close for candle in`</mark> [<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`('m15')])"`</mark>

```
mean([candle.close for candle in candles('m15')])
```

</details>


# Execute Volume

The parameter that specifies the amount to be placed, denominated in the base token.

## <mark style="color:purple;">`execute_volume`</mark> \[*decimal* | *formula* -> \[*decimal*]]

Volume (amount) value for each order in grid, denominated in the base token. It accepts both integer and decimal inputs and allows the use of formulas as values.

It must be borne in mind that when the quantity in the volume parameter changes and in the absence of the [<mark style="color:blue;">`sleep_after_seconds`</mark>](/function/optional-parameters/sleep-after-seconds) parameter, the grid will immediately re-place orders on the exchange, which leads to an increase in the load on the communication channel with the exchange. For correct operation, it is advisable to use the [<mark style="color:blue;">`sleep_after_seconds`</mark>](/function/optional-parameters/sleep-after-seconds) parameter and the [<mark style="color:blue;">`cached`</mark>](/function/functions/cached) function.

It is mandatory to use the [<mark style="color:blue;">`cached`</mark>](/function/functions/cached) function or the [<mark style="color:blue;">`sleep_after_seconds`</mark>](/function/optional-parameters/sleep-after-seconds) parameter when using the [<mark style="color:blue;">`random`</mark>](/function/functions/random) function.

{% hint style="danger" %}
Always positive value. Can’t be zero.
{% endhint %}

{% hint style="info" %}
Supports the use of the iterable parameter [`order_pos`](/function/pre-defined-parameters/order-pos) to facilitate the placement of multiple orders.
{% endhint %}

{% hint style="info" %}
It is possible to use the [<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price) parameter, which also supports the use of [<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos).
{% endhint %}

<details>

<summary>Example:</summary>

The order of 2345.95 amount will be placed in the base token.

<mark style="color:red;">`"execute_volume": "2345.95"`</mark>

***

The order will be executed in the amount of 10 divided by the market price of the base token. For example, if the counter token is USDT, then this is equivalent to placing an order of 10 USDT denominated in the base token.

<mark style="color:red;">`"execute_volume": "10 /`</mark> [<mark style="color:blue;">`ticker`</mark>](/function/functions/ticker)<mark style="color:red;">`()"`</mark>

```
10 / ticker()
```

***

The order will be executed in the amount of 100 plus 10 multiplied by the sequence number of the order in the grid, divided by the price of the base token. For example, if the counter token is USDT, then this is equivalent to placing an order of 100 USDT plus 10 USDT multiplied by the ordinal number of the order in the grid, denominated in the base token.

<mark style="color:red;">`"execute_volume": "(100 + 10 *`</mark> [<mark style="color:blue;">`abs`</mark>](/function/functions/abs)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`order_pos`</mark>](/function/pre-defined-parameters/order-pos)<mark style="color:red;">`)) /`</mark> [<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)<mark style="color:red;">`"`</mark>

```
(100 + 10 * abs(order_pos)) / execute_price
```

***

The order will be executed in an amount equal to the size of the first market bid, but not exceeding 100 divided by the price of the executed order. This means that if the counter token is USDT, the order amount will be capped at a value equivalent to 100 USDT, denominated in the base token.

<mark style="color:red;">`"execute_volume": "`</mark>[<mark style="color:blue;">`min`</mark>](/function/functions/min)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().bid[0].amount,100/`</mark>[<mark style="color:blue;">`execute_price`</mark>](/function/required-parameters/execute-price)<mark style="color:red;">`)"`</mark>

```
min(orderbook().bid[0].amount,100/execute_price)
```

***

The order will be executed in an amount equal to the total of all orders up to and including the first own ask order in the market.

<mark style="color:red;">`"execute_volume": "sum([ask.amount if ask.price <=`</mark> [<mark style="color:blue;">`own`</mark>](/function/functions/own)<mark style="color:red;">`().ask[0].price else 0 for ask in`</mark>  [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`().ask])"`</mark>

```
sum([ask.amount if ask.price <= own().ask[0].price else 0 for ask in orderbook().ask])
```

***

The order will be executed in the amount of 10% of the current available ETH balance, but not more than 0.2.

<mark style="color:red;">`"execute_volume": "`</mark>[<mark style="color:blue;">`min`</mark>](/function/functions/min)<mark style="color:red;">`(`</mark>[<mark style="color:blue;">`balance`</mark>](/function/functions/balance)<mark style="color:red;">`('ETH').available * 0.1, 0.2)"`</mark>

```
min(balance('ETH').available * 0.1,0.2)
```

</details>


# Base logic

Understand Origami Tech’s base logic structure used to build dynamic, rule-based trading strategies with logical conditions and data processing functions.

## Boolean operators

### <mark style="color:red;">`()`</mark>

Breakets can be used to combine expressions

### <mark style="color:red;">`x if smth else y`</mark>

Conditional operator.

Returns <mark style="color:red;">`x`</mark> if <mark style="color:red;">`smth`</mark> is True

Returns <mark style="color:red;">`y`</mark> if <mark style="color:red;">smth</mark> is False

<mark style="color:red;">`x`</mark>, <mark style="color:red;">`y`</mark>, <mark style="color:red;">`smth`</mark> - can be <mark style="color:red;">`decimal`</mark>, <mark style="color:red;">`function call`</mark>, <mark style="color:red;">`custom formula`</mark>, <mark style="color:red;">`math expr`</mark> or <mark style="color:red;">`bool`</mark>

### <mark style="color:red;">`<x> or <y>`</mark>

Boolean operator <mark style="color:red;">`or`</mark>. Returns <mark style="color:red;">`bool`</mark>

Any non-zero value for operands casts as True (ex: 1 → True, 0 → False)

Truth table:

| x     | y     | result |
| ----- | ----- | ------ |
| True  | True  | True   |
| True  | False | True   |
| False | True  | True   |
| False | False | False  |

### <mark style="color:red;">`<x> and <y>`</mark>

Boolean operator <mark style="color:red;">`and`</mark>. Returns <mark style="color:red;">`bool`</mark>

Any non-zero value for operands casts as True (ex: 1 → True, 0 → False)

Truth table:

| x     | y     | result |
| ----- | ----- | ------ |
| True  | True  | True   |
| True  | False | False  |
| False | True  | False  |
| False | False | False  |

### <mark style="color:red;">`<x> == <y>`</mark>

Equivalent op. Returns <mark style="color:red;">`bool`</mark>

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 1 | True   |
| 0 | 1 | False  |
| 1 | 0 | False  |

### <mark style="color:red;">`` `<x> ``</mark>

Boolean operator <mark style="color:red;">`and`</mark>. Returns <mark style="color:red;">`bool`</mark>

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 1 | False  |
| 1 | 0 | True   |
| 0 | 1 | True   |

### <mark style="color:red;">`<x> > <y>`</mark>

\#v1 #v2

Boolean operator <mark style="color:red;">`greater`</mark>. Returns <mark style="color:red;">`bool`</mark>

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | True   |
| 0 | 1 | False  |
| 1 | 1 | False  |

### <mark style="color:red;">`<x> >= <y>`</mark>

\#v1 #v2

Boolean operator <mark style="color:red;">`greater or equivalent`</mark>. Returns <mark style="color:red;">`bool`</mark>

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | True   |
| 0 | 1 | False  |
| 1 | 1 | True   |

### <mark style="color:red;">`<x> < <y>`</mark>

\#v1 #v2

Boolean operator <mark style="color:red;">`less`</mark>. Returns <mark style="color:red;">`bool`</mark>

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | False  |
| 0 | 1 | True   |
| 1 | 1 | False  |

### <mark style="color:red;">`<x> <= <y>`</mark>

\#v1 #v2

Boolean operator <mark style="color:red;">`less or equivalent`</mark>. Returns <mark style="color:red;">`bool`</mark>

Truth table:

| x | y | result |
| - | - | ------ |
| 1 | 0 | False  |
| 0 | 1 | True   |
| 1 | 1 | True   |

## Math operators

### <mark style="color:red;">`()`</mark>

Breakets can be used to combine expressions

### <mark style="color:red;">`<x> / <y>`</mark>

Division operator. Returns `decimal`

### <mark style="color:red;">`<x> * <y>`</mark>

Multiplication operator. Returns `decimal`

### <mark style="color:red;">`<x> + <y>`</mark>

Sum operator. Returns `decimal`

### <mark style="color:red;">`<x> - <y>`</mark>

Subtraction operator. Returns `decimal`

### <mark style="color:red;">`<x> ** <y>`</mark>

Exponentiation operator. Returns `decimal`

### <mark style="color:red;">`<x> ^ <y>`</mark>


# Optional parameters

Additional parameters that can be used for additional grid settings.

<table data-header-hidden><thead><tr><th width="358">Function</th><th>Description</th></tr></thead><tbody><tr><td><h2><a href="/pages/nonHZUhqHrPNaBIkNgxp"><mark style="color:blue;"><code>time_between_orders</code></mark></a></h2></td><td>Execute orders one by one with delay in seconds.</td></tr><tr><td><h2><a href="/pages/rMkbGB41111wYAn0LPs9"><mark style="color:blue;"><code>sleep_after_seconds</code></mark></a></h2></td><td>Time to sleep after grid execution in seconds.</td></tr><tr><td><h2><a href="/pages/UgcGHhuyEikeM2q1R3hC"><mark style="color:blue;"><code>is_buy_first</code></mark></a></h2></td><td>Should buy orders place first or not.</td></tr></tbody></table>

<details>

<summary>An example of a simple grid</summary>

The grid will place two sell orders and two buy orders, each at a 0.5% increment from the current market price. The order amount will be calculated as 10 divided by the current market price. Orders will be placed at 1-second intervals, with a 60-second gap between each cycle. Sell orders will be placed first.

```json
{
    "execute_price": "ticker()*(1+0.005*order_pos)",
    "execute_volume": "10/ticker()",
    "buy_orders_count": "2",
    "sell_orders_count": "2",
    "time_between_orders": "1",
    "sleep_after_seconds": "60",
    "is_buy_first": "0"
}
```

</details>


# Time Between Orders

Execute orders one by one with delay in seconds

## <mark style="color:purple;">`time_between_orders`</mark> -> *decimal*

Execute orders one by one with <mark style="color:red;">`time_between_orders`</mark> delay (seconds)

{% hint style="danger" %}
Doesn’t support custom formulas.
{% endhint %}


# Sleep After Seconds

Time to sleep after grid execution in seconds.

## <mark style="color:purple;">`sleep_after_seconds`</mark> -> decimal

Time to sleep after grid execution (seconds). Accepts values of integer and decimal types. It is possible to use <mark style="color:red;">`formula`</mark> as value.

<details>

<summary>Example:</summary>

The orders will be executed with a delay of 300 seconds between executions.

<mark style="color:red;">`“sleep_after_seconds”: “300"`</mark>

***

The orders will be executed with a random delay of 30 - 90 seconds between executions.

<mark style="color:red;">`“sleep_after_seconds”: “60*(0.5+`</mark>[<mark style="color:blue;">`random`</mark>](/function/functions/random)<mark style="color:red;">`())"`</mark>

```
60 * (0.5 + random())
```

</details>


# Is Buy First

Should buy orders place first or not.

## <mark style="color:purple;">`is_buy_first`</mark> -> enum(1|0)

Determines the priority of placing orders within a single grid. 1 - buy orders are placed first. 0 - sell orders are placed first.


# Functions

Functions that can be called inside the grid parameters.

## Market Data

<table data-header-hidden data-full-width="true"><thead><tr><th width="342">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><a href="/pages/vBJtwkBbxgLdMwiqplZq"><mark style="color:blue;"><code>ticker</code></mark></a></h3></td><td>The current market price of the latest traid on the market.</td></tr><tr><td><h3><a href="/pages/dp1E7DG3xZkkJKzKPBGY"><mark style="color:blue;"><code>orderbook</code></mark></a></h3></td><td>Orderbook from the market in the <a href="/pages/AVpLEudbWCHaLDLJPF0o"><mark style="color:blue;">Orderbook</mark></a> structure.</td></tr><tr><td><h3><a href="/pages/vc72nw3PaD2xKgGGD5wg"><mark style="color:blue;"><code>candles</code></mark></a></h3></td><td>Market candlesticks in the <a href="/pages/Xvc8UiJyVJn1I8gx8cUT"><mark style="color:blue;">Candle</mark></a> structure.</td></tr><tr><td><h3><a href="/pages/xVgpRCM2UzuJUTIzLKgF"><mark style="color:blue;"><code>own</code></mark></a></h3></td><td>Self orders in the <a href="/pages/AVpLEudbWCHaLDLJPF0o"><mark style="color:blue;">Orderbook</mark></a> structure.</td></tr><tr><td><h3><a href="/pages/vuks4i6s7eQJfS9NxEsm"><mark style="color:blue;"><code>vwap</code></mark></a></h3></td><td>Calculates the volume-weighted average.</td></tr><tr><td><h3><a href="/pages/rgg8QEJLqSGTfUK4mrq9"><mark style="color:blue;"><code>amount_before_price</code></mark></a></h3></td><td>The amount of basic tokens up to a certain price.</td></tr><tr><td><h3><a href="/pages/5NgRRsQ242yuYRHVvrUB"><mark style="color:blue;"><code>amount_threshold_index</code></mark></a></h3></td><td></td></tr></tbody></table>

***

## Balances and Exchange info

<table data-header-hidden data-full-width="true"><thead><tr><th width="240">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><a href="/pages/CEZal44BXH80x44GrEyJ"><mark style="color:blue;"><code>symbol</code></mark></a></h3></td><td>Exchange information in <a href="/pages/sUiJgz3vLYeR8qReYyDq">Symbol</a> structure.</td></tr><tr><td><h3><a href="/pages/o3gbsYcTdx2z4rIMcITI"><mark style="color:blue;"><code>balance</code></mark></a></h3></td><td>Token balance of certain exchange in <a href="/pages/mNaQxvV1ODnFvuGZpUuf">Balance</a> structure.</td></tr><tr><td><h3><a href="/pages/UgDb5FgjkhbcmGvvWP8J"><mark style="color:blue;"><code>saved_balance</code></mark></a></h3></td><td>Saved token balance of certain exchange in <a href="/pages/mNaQxvV1ODnFvuGZpUuf">Balance</a> structure.</td></tr><tr><td><h3><a href="/pages/VubzB1QaDDuU7zwwaNk5"><mark style="color:blue;"><code>group_balance</code></mark></a></h3></td><td>The sum of the token balances from all exchanges in the group in <a href="/pages/qGCniJ0oiSNXH59lDfoN">Group Balace</a> structure.</td></tr></tbody></table>

***

## Calculations

<table data-header-hidden data-full-width="true"><thead><tr><th width="252">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><a href="/pages/ADE1v2zZEp1K8H8Io5hM"><mark style="color:blue;"><code>mean</code></mark></a></h3></td><td>Compute the arithmetic mean (average) of the given list elements.</td></tr><tr><td><h3><a href="/pages/tB9b6H9V120z1QJlVL2v"><mark style="color:blue;"><code>median</code></mark></a></h3></td><td>Compute the median of the given list elements.</td></tr><tr><td><h3><a href="/pages/tciNnhsKiwLMxZJgZhvy"><mark style="color:blue;"><code>max</code></mark></a></h3></td><td>Returns max value of the given list elements.</td></tr><tr><td><h3><a href="/pages/UzA7uxr0ruhygx6HYdyE"><mark style="color:blue;"><code>min</code></mark></a></h3></td><td>Returns min value of the given list elements.</td></tr><tr><td><h3><a href="/pages/WXDWL6i2xJUG9Snl57TZ"><mark style="color:blue;"><code>exp</code></mark></a></h3></td><td>Calculates the exponent value.</td></tr><tr><td><h3><a href="/pages/vHuwIHANnLkoml1mW9YD"><mark style="color:blue;"><code>abs</code></mark></a></h3></td><td>Returns the absolute value of the given number.</td></tr><tr><td><h3><a href="/pages/kOlZOlCyD07M0GWsEzIn"><mark style="color:blue;"><code>logn</code></mark></a></h3></td><td>Calculates the value of the natural logarithm.</td></tr><tr><td><h3><a href="/pages/gXQmEZS62Ao7THKspt3d"><mark style="color:blue;"><code>count</code></mark></a></h3></td><td>Returns the number of the given list elements.</td></tr><tr><td><h3><a href="/pages/rXnZXSCQQWihGYVhdevB"><mark style="color:blue;"><code>random</code></mark></a></h3></td><td>Random decimal value in range [0, 1].</td></tr><tr><td><h3><a href="/pages/36Kv4zzhSB1hDf2nkZ5w"><mark style="color:blue;"><code>sum</code></mark></a></h3></td><td>Sum of the given list elements.</td></tr></tbody></table>

***

## Other

<table data-header-hidden data-full-width="true"><thead><tr><th width="254">Function</th><th>Description</th></tr></thead><tbody><tr><td><h3><a href="/pages/axPY13eyhaOaHJU8vdPG"><mark style="color:blue;"><code>cached</code></mark></a></h3></td><td>Used to cache the results of calculating the cached_value formula for the ttl time in seconds.</td></tr><tr><td><h3><a href="/pages/O0buPabcaamf2h47LXSm"><mark style="color:blue;"><code>remove_nan</code></mark></a></h3></td><td>Drop decimal(Nan) of the given list elements.</td></tr><tr><td><h3><a href="/pages/BKIGcxFm9yvxldltnEmc"><mark style="color:blue;"><code>is_nan</code></mark></a></h3></td><td>True if input Nan and False if input not Nan.</td></tr><tr><td><h3><a href="/pages/ACurTfzTynxjF4tna1ow"><mark style="color:blue;"><code>var</code></mark></a></h3></td><td></td></tr></tbody></table>


# Ticker

Current market price of latest trade on exchange.

## <mark style="color:purple;">`ticker`</mark>(*symbol*: *Optional*\[*str*], *exchange*: *Optional*\[*int*|*str*]) -> *decimal*

Returns last price for <mark style="color:red;">`symbol`</mark> on <mark style="color:red;">`exchange`</mark> .

**Parameters:**

**symbol :&#x20;*****str*****,&#x20;*****default 'base-counter'***

Use token symbols in the 'symbol-symbol' format. Example: <mark style="color:red;">`'ETH-USDT'`</mark>,`'`[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-USDT'`</mark>,<mark style="color:red;">`’ETH-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`’`</mark>. If <mark style="color:red;">`symbol`</mark> is empty - uses current symbol for bot. Shortcuts [`base`](/function/shortcuts/base) and [`counter`](/function/shortcuts/counter) could be used.

**exchange :&#x20;*****int|str*****,&#x20;*****default bot's exchange***

If <mark style="color:red;">`exchange`</mark> is empty - uses current exchange for bot’s account. Exchanges names and indexes could be found in [<mark style="color:blue;">Exchange list</mark>](/function/exchanges-list).

**Returns:&#x20;*****Decimal***

<details>

<summary>Example:</summary>

Returns the last price for current bot's symbol and exchange.

```
ticker()
```

***

Returns the last price from Bybit for current bot's symbol. [<mark style="color:blue;">Exchange Names</mark>](/function/exchanges-list).

```
ticker('base-counter','bybit')
```

***

Returns Bybit's last price for current bot's symbol. [<mark style="color:blue;">Exchange ID</mark>](/function/exchanges-list).

```
ticker('base-counter',23)
```

***

Returns Binance's last price for current bot's base in ETH. [<mark style="color:blue;">Exchange Names</mark>](/function/exchanges-list).

```
ticker('base-ETH','binance')
```

***

Returns Gate's last price for ETH in USDT.

```
ticker('ETH-USDT','gateio')
```

***

Converts current bot's Base in ETH price to price in USDT.

```
ticker('base-ETH')*ticker('ETH-USDT','bybit')
```

</details>


# Orderbook

An order book is a comprehensive record maintained by a trading platform, documenting the buy and sell orders that reflect the interests of market participants.

## <mark style="color:purple;">`orderbook`</mark>(*symbol*: *Optional*\[*str*], *exchange*: *Optional*\[*str*|*int*]) -> \[[*<mark style="color:blue;">Orderbook</mark>*](/function/structures/orderbook)]

Returns orderbook in [Orderbook](/function/structures/orderbook) structure.

**Parameters:**

**symbol :&#x20;*****str, default 'base-counter'***

Use token symbols in the 'symbol-symbol' format. Example: <mark style="color:red;">`'ETH-USDT'`</mark>,`'`[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-USDT'`</mark>,<mark style="color:red;">`’ETH-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`’`</mark>. If <mark style="color:red;">`symbol`</mark> is empty - uses current symbol for bot. Shortcuts [`base`](/function/shortcuts/base) and [`counter`](/function/shortcuts/counter) could be used.

**exchange : int|str, default bot's exchange**

If <mark style="color:red;">`symbol`</mark> is empty - uses current symbol for bot. (ex.: <mark style="color:red;">`'ETH-USDT'`</mark>, [<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-USDT`</mark>,<mark style="color:red;">`’ETH-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`’`</mark>)

If <mark style="color:red;">`exchange`</mark> is empty - uses current exchange for bot’s account

{% hint style="warning" %} <mark style="color:red;">`symbol`</mark> must be specified for usage in <mark style="color:red;">`update_balance_formula`</mark> inside group
{% endhint %}

{% hint style="warning" %} <mark style="color:red;">`exchange`</mark> must be specified for usage in <mark style="color:red;">`update_balance_formula`</mark> inside group
{% endhint %}

<details>

<summary>Example:</summary>

<mark style="color:red;">`orderbook().bid[0].price`</mark> → 0.65…

<mark style="color:red;">`orderbook('`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`').bid[0].price`</mark> → 0.65…

<mark style="color:red;">`orderbook().bid[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(’`</mark>[<mark style="color:blue;">`base`</mark>](/function/shortcuts/base)<mark style="color:red;">`-`</mark>[<mark style="color:blue;">`counter`</mark>](/function/shortcuts/counter)<mark style="color:red;">`’,'mexc').bid[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(’ETH-USDT’).bid[0].amount`</mark> → 3000

<mark style="color:red;">`orderbook('BTC-ETH', exchange='gateio').bid[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(exchange=8).ask[0].amount`</mark> → 300.51

<mark style="color:red;">`orderbook(exchange='mexc').ask[0].amount`</mark> → 100.23

</details>


# Candles

A candlestick is a type of price chart that represents the high, low, opening, and closing prices of a token over a defined time frame.

## <mark style="color:purple;">`candles`</mark>(*interval*: *str*, *symbol*: *str*, *exchange*: *str*, *count*: *Optional*\[*int*] = *100*) -> *List*\[\[[*<mark style="color:blue;">Candle</mark>*](/function/structures/candle)]]

<mark style="color:red;">`interval`</mark> can be one of the following: <mark style="color:red;">`s10`</mark>, <mark style="color:red;">`m1`</mark>, <mark style="color:red;">`m3`</mark>, <mark style="color:red;">`m5`</mark>, <mark style="color:red;">`m15`</mark>, <mark style="color:red;">`m30`</mark>, <mark style="color:red;">`m45`</mark>, <mark style="color:red;">`h1`</mark> , <mark style="color:red;">`h2`</mark>, <mark style="color:red;">`h3`</mark>, <mark style="color:red;">`h4`</mark>, <mark style="color:red;">`h6`</mark>, <mark style="color:red;">`h8`</mark>, <mark style="color:red;">`h12`</mark>, <mark style="color:red;">`d1`</mark>, <mark style="color:red;">`w1`</mark>, <mark style="color:red;">`M1`</mark>

If exchange does not support selected interval, the minimum supported interval will be used.

Candles sorted by ascending timestamp. Candle with index \[0] this is the newest candle.

by default return list of 100 Candles and max size 100 Candles.

Example:


# Organic

An order book with excluded self orders.

## <mark style="color:purple;">`organic`</mark>([*<mark style="color:blue;">orderbook</mark>*](/function/functions/orderbook): [*<mark style="color:blue;">Orderbook</mark>*](/function/structures/orderbook), *bot\_id*: *Optional*\[*int*]) -> \[[*<mark style="color:blue;">Orderbook</mark>*](/function/structures/orderbook)]

If <mark style="color:red;">`bot_id`</mark> is empty - uses current bot

<details>

<summary>Example:</summary>

<mark style="color:red;">`organic(`</mark>[<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook)<mark style="color:red;">`()).bid[0].price`</mark>` ``→ 0.65…`

</details>


# VWAP

The volume-weighted average price is a metric that represents the ratio of the total traded value of a token to the aggregate trading volume during a specific session.

## <mark style="color:purple;">`vwap`</mark>(*amounts*:*list*\[*decimal*], *prices*: *list*\[*decimal*]) -> *decimal*|*None*

The volume-weighted average price (VWAP) is a metric that represents the ratio of the total traded value of a token to the aggregate trading volume during a specific period. It serves as an indicator of the average trading price over that period.

Returns decimal

<details>

<summary>Compute the volume-weighted average price</summary>

`VWAP = Σ (Volume * Price) / Σ Volume`

recommended to use

`Price = ( High + Low + Close ) / 3`

</details>

Example:


# Amount Before Price

The Amount Before Price function in Origami Tech measures cumulative liquidity before a price level, useful for order book and slippage analysis.

## <mark style="color:purple;">`amount_before_price`</mark>(*threshold\_price*:*decimal*, *amounts*: *list*\[*decimal*], *prices*: *list*\[*decimal*], *side*: *union*\["*ask*"|"*bid*") -> *decimal*|*None*

Example:


# Amount Threshold Index

The Amount Threshold Index function in Origami Tech identifies liquidity zones in order books, helping optimize trade entry and execution logic.

## <mark style="color:purple;">`amount_threshold_index`</mark>(*threshold*: *Decimal*, *amounts*: *list*\[*decimal*]) -> *decimal*|*None*

Example:


# Symbol

An exchange meta-information regarding ticker symbol parameters, associated fees, and the precision of data.

## <mark style="color:purple;">`symbol`</mark>() -> \[[*<mark style="color:blue;">Symbol</mark>*](/function/structures/symbol)]

Returns [<mark style="color:blue;">`symbol`</mark>](/function/structures/symbol) structure for current ticker symbol and exchange.

<details>

<summary>Example:</summary>

</details>


# Balance

Explore how the Balance function in Origami Tech retrieves and processes account balances, asset values, and portfolio data for trading automation.

## <mark style="color:purple;">`balance`</mark>(*coin*: *str*, *account\_id*: *Optional*\[*int*]) -> \[[*<mark style="color:blue;">Balance</mark>*](/function/structures/balance)]

Parametrs:

coin: {‘base’, ‘counter’, token ticker}

<mark style="color:red;">`coin`</mark> \[shortcuts] can’t be used in <mark style="color:red;">`update_balance_formula`</mark> inside group

account\_id: int, default current bot account id

<mark style="color:red;">`account_id`</mark> should be specified for usage in <mark style="color:red;">`update_balance_formula`</mark> inside group

Returns:

Returns structure that can be used to obtain balance of tokens on the account

<details>

<summary>Example:</summary>

<mark style="color:red;">`balance('USDT').available`</mark> → 1000.2

<mark style="color:red;">`balance('ETH').reserved`</mark> → 20.3

<mark style="color:red;">`balance(’BTC’).total`</mark> → 1.5

<mark style="color:red;">`balance(’counter’).reserved`</mark> → 6.55

<mark style="color:red;">`balance('base').total`</mark> → 300.5

<mark style="color:red;">`balance('base', account_id=100).total`</mark> → 10

</details>


# Saved Balance

Learn how to use the Saved Balance function in Origami Tech to reference previously stored account balances in automated trading strateg

## <mark style="color:purple;">`saved_balance`</mark>(*coin*: *str*, *account\_id*: *Optional*\[*int*]) -> \[[*<mark style="color:blue;">Balance</mark>*](/function/structures/balance)]

Returns structure that can be used to obtain balance of tokens saved at the moment when <mark style="color:red;">`update_balance_formula`</mark> returns <mark style="color:red;">`True`</mark> or any other non-zero value

If <mark style="color:red;">`account_id`</mark> is empty - uses current exchange for bot’s account id

<mark style="color:red;">`coin`</mark> check \[<mark style="color:red;">`balance`</mark>] specification

**Important:** can’t be used in <mark style="color:red;">`update_balance_formula`</mark> inside group

<details>

<summary>Example:</summary>

<mark style="color:red;">`saved_balance('ETH').available`</mark> → 100.2

<mark style="color:red;">`saved_balance('base').reserved`</mark> → 200.3

<mark style="color:red;">`saved_balance(’counter’).total`</mark> → 300.5

<mark style="color:red;">`saved_balance('USDT').total`</mark> → 400.55

</details>


# Group Balance

Understand how the Group Balance function in Origami Tech aggregates balances across multiple accounts or assets for consolidated reporting.

## <mark style="color:purple;">`group_balance`</mark>(*coin*: *str*, *group\_id*: *Optional*\[*int*]) -> \[[*<mark style="color:blue;">GroupBalance</mark>*](/function/structures/groupbalance)]

Returns structure that can be used to obtain balance of tokens saved at the moment when <mark style="color:red;">`update_balance_formula`</mark> **in group** returns <mark style="color:red;">`True`</mark> or any other non-zero value

If <mark style="color:red;">`group_id`</mark> is empty - uses current exchange for bot’s account.group\_id

<mark style="color:red;">`coin`</mark> check \[<mark style="color:red;">`balance`</mark>] specification

<details>

<summary>Example:</summary>

<mark style="color:red;">`group_balance('USDT').start.available`</mark> → 100.2

<mark style="color:red;">`group_balance('ETH').start.reserved`</mark> → 2.3056

<mark style="color:red;">`group_balance(’base’).current.available`</mark> → 300.5

<mark style="color:red;">`group_balance('counter').current.total`</mark> → 300.5

<mark style="color:red;">`group_balance('base', group_id=100).start.total`</mark> → 100.1

</details>


# Mean

Learn how to use the Mean function in Origami Tech to calculate average values from data sets for technical indicators and performance metrics.

## <mark style="color:purple;">`mean`</mark>(*list*\[*decimal*]) -> *decimal*

Returns decimal

Compute the arithmetic mean (average) of the given list elements

<details>

<summary>Example:</summary>

<mark style="color:red;">`mean([2.2, 2.5])`</mark> → <mark style="color:red;">`2.35`</mark>

</details>


# Median

The Median function in Origami Tech identifies the central numeric value in a dataset, useful for trend smoothing and statistical modeling.

## <mark style="color:purple;">`median`</mark>(*list*\[*decimal*]) -> *decimal*

Returns decimal

Compute the median of the given list elements

<details>

<summary>Example:</summary>

<mark style="color:red;">`median([2.2, 2.5, 5.5])`</mark>` ``→`` `<mark style="color:red;">`2.5`</mark>

</details>


# Max

The Max function in Origami Tech identifies the largest numeric value from inputs, useful for conditional checks and dynamic trading calculations.

## <mark style="color:purple;">`max`</mark>(*tuple*\[*decimal*,...]) -> *decimal*

Returns max value from provided parameters

<details>

<summary>Example:</summary>

<mark style="color:red;">`max(0.1, 0.2)`</mark>` ``→`` `<mark style="color:red;">`0.2`</mark>

</details>


# Min

The Min function in Origami Tech identifies the smallest numeric value from a data set, ideal for comparison and threshold-based trading logic.

## <mark style="color:purple;">`min`</mark>(*tuple*\[*decimal*,...]) -> *decimal*

Returns min value from provided parameters

<details>

<summary>Example:</summary>

<mark style="color:red;">`min(0.1, 0.2)`</mark>` ``→`` `<mark style="color:red;">`0.2`</mark>

</details>


# Exp

Learn how the Exp function in Origami Tech performs exponential calculations to build advanced formulas and algorithmic trading strategies.

## <mark style="color:purple;">`exp`</mark>(*decimal*) -> *decimal*

Returns decimal

Compute the exponent value

<details>

<summary>Example:</summary>

<mark style="color:red;">`exp(5)`</mark>` ``→`` `<mark style="color:red;">`148.4131591025766`</mark>

</details>


# Abs

The Abs function in Origami Tech returns the absolute value of a number, useful for managing signals, risk, and calculations in trading logic.

## <mark style="color:purple;">`abs`</mark>(*decimal*) -> *decimal*

Returns the absolute value of the given number

<details>

<summary>Example:</summary>

<mark style="color:red;">`abs(-0.1)`</mark>` ``→`` `<mark style="color:red;">`0.1`</mark>

<mark style="color:red;">`abs(0.1)`</mark>` ``→`` `<mark style="color:red;">`0.1`</mark>

</details>


# Logn

The Logn function in Origami Tech calculates natural logarithmic values for advanced algorithmic and statistical analysis.

## <mark style="color:purple;">`logn`</mark>(*x*: *decimal*) -> *decimal*

Natural log. Returns `decimal`


# Count

Learn how to use the Count function in Origami Tech to count data entries, signal events, or conditions within your automated strategies.

## <mark style="color:purple;">`count`</mark>(*list*\[*Any*]) -> *int*

Returns the number of list elements

<details>

<summary>Example:</summary>

<mark style="color:red;">`count([orderbook().ask])`</mark> → <mark style="color:red;">`50`</mark>

<mark style="color:red;">`count([ask.price for ask in orderbook().ask if ask.price < 1200])`</mark>` ``→`` `<mark style="color:red;">`23`</mark>

</details>


# Random

Learn how to use the Random function in Origami Tech to generate random values for simulations, strategy testing, or stochastic model creation.

## <mark style="color:purple;">`random`</mark>() -> *decimal*

returns random decimal value in range <mark style="color:red;">`[0, 1]`</mark>

{% hint style="warning" %}
Be careful using this function in execute\_price or execute\_volume. Usage without cached will lead to unstoppable recreate of the grid.
{% endhint %}


# Sum

The Sum function in Origami Tech adds multiple numeric values, ideal for portfolio aggregation, position sizing, and performance metrics.


# Cached

Understand how the Cached function in Origami Tech temporarily stores computed data to reduce recalculation time and optimize strategy performance.

## <mark style="color:purple;">`cached`</mark>(*ttl*: *int*, *respect*: *str* =’*order\_pos*’)(*cached\_value*: *str*)

Function that is typically used for caching equitation results of <mark style="color:red;">`cached_value`</mark> formula.

<mark style="color:red;">`cached_value`</mark> string representation is used as a key for cache

<mark style="color:red;">`ttl`</mark> positive integer which is defines time-to-live for cache

<mark style="color:red;">`respect`</mark> one of (default <mark style="color:red;">`order_pos`</mark>):

* <mark style="color:red;">`order_pos`</mark> - calculate <mark style="color:red;">`cached_value`</mark> for each order in grid
* <mark style="color:red;">`grid`</mark> - calculate <mark style="color:red;">`cached_value`</mark> for the whole grid
* <mark style="color:red;">`bot`</mark> - calculate <mark style="color:red;">`cached_value`</mark> for the whole bot
* <mark style="color:red;">`global`</mark> - calculate <mark style="color:red;">`cached_value`</mark> . Results are used for all bots

{% hint style="warning" %} <mark style="color:red;">`respect=”order_pos”`</mark> must not be used with <mark style="color:red;">`update_balance_formula`</mark> inside group and bot
{% endhint %}

{% hint style="warning" %} <mark style="color:red;">`respect=”grid”`</mark> must not be used with <mark style="color:red;">`update_balance_formula`</mark> inside group and bot
{% endhint %}

{% hint style="warning" %} <mark style="color:red;">`respect=”bot”`</mark> must not be used with <mark style="color:red;">`update_balance_formula`</mark> inside group
{% endhint %}

<mark style="color:red;">`respect='order_pos'`</mark> orders are the same during <mark style="color:red;">`ttl`</mark> seconds

<mark style="color:red;">`respect='grid'`</mark> all orders are placed with the same inside one grid during <mark style="color:red;">`ttl`</mark> seconds

{% hint style="warning" %}
Grids must exist to use this type of cache due to the need to get the <mark style="color:red;">`grid.id`</mark>
{% endhint %}

but the price changes between grids

<mark style="color:red;">`respect='bot'`</mark> all orders are placed with the same over the all grids in one bot during <mark style="color:red;">`ttl`</mark> seconds \*Warning: bot must exist to use this type of cache due to the need to get the <mark style="color:red;">`bot.id`</mark>

<mark style="color:red;">`respect='global'`</mark> all orders are placed with the same over the all bots during `ttl` seconds

Example:


# Remove NaN

Deleting NaN values in the list.

## <mark style="color:purple;">`remove_nan`</mark>(*list*\[*decimal*]) -> *list*\[*decimal*]

Returns list with dropped decimal(Nan)

<details>

<summary>Example:</summary>

<mark style="color:red;">`remove_nan([0.2, 0.1, Nan])`</mark>` ``→`` `<mark style="color:red;">`[0.2, 0.1]`</mark>

</details>


# Is NaN

Learn how to use the Is NaN function in Origami Tech to check for missing or invalid numeric values, ensuring data accuracy in trading scripts.

## <mark style="color:purple;">`is_nan`</mark>(*decimal*) -> *bool*

Returns bool

True if input Nan and False if input not Nan

<details>

<summary>Example:</summary>

<mark style="color:red;">`is_nan(Nan)`</mark> → <mark style="color:red;">`true`</mark>

<mark style="color:red;">`is_nan(1.1)`</mark> → <mark style="color:red;">`false`</mark>

</details>


# Var

The Var function in Origami Tech calculates statistical variance to analyze data dispersion, volatility, and performance consistency in trading models.

## <mark style="color:purple;">`var`</mark>(*name*: *str*, *default*: *decimal*, *cache\_by*: *tuple*=())

Function that is used for holding dynamic variables. Returns object that supports:

<mark style="color:red;">`get() -> decimal`</mark>

returns value of variable or default if unset

<mark style="color:red;">`set(value: decimal, ttl: decimal=inf) -> decimal`</mark>

set value to `value` , returns value

<mark style="color:red;">`ttl`</mark> - optional ttl of variable, default to inf

Examples:

<mark style="color:red;">`get`</mark> returns 5 if variable unset

Set variable’s value to 10

Example:


# Technical analysis

Technical analysis is a collection of tools used for forecasting probability price movements based on patterns in historical price changes.

<table data-header-hidden data-full-width="true"><thead><tr><th width="227">Function</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/SF3GsBpf9UHl8XpSPR0X"><mark style="color:blue;"><code>rsi</code></mark></a></td><td><h2><a href="/pages/SF3GsBpf9UHl8XpSPR0X">Relative Strenght Index</a></h2></td></tr><tr><td><a href="/pages/66PYnQz6XoazefeAtDPZ"><mark style="color:blue;"><code>rsi_to_price</code></mark></a></td><td><h2><a href="/pages/66PYnQz6XoazefeAtDPZ">RSI to price</a></h2></td></tr><tr><td><a href="/pages/j4Yp4ZmV6FnV6Q2AQSE5"><mark style="color:blue;"><code>atr</code></mark></a></td><td><h2><a href="/pages/j4Yp4ZmV6FnV6Q2AQSE5">Average True Range</a></h2></td></tr><tr><td><a href="/pages/Qgfr3DszNxDUpPZDAseQ"><mark style="color:blue;"><code>bbands</code></mark></a></td><td><h2><a href="/pages/Qgfr3DszNxDUpPZDAseQ">Bollinger Bands</a></h2></td></tr><tr><td><a href="/pages/ISddX1RMQ3okuO3zlpBd"><mark style="color:blue;"><code>do</code></mark></a></td><td><h2><a href="/pages/ISddX1RMQ3okuO3zlpBd">Donchian Channel</a></h2></td></tr><tr><td><a href="/pages/Bgr1h4kbMIZ70AOsfY4y"><mark style="color:blue;"><code>ema</code></mark></a></td><td><h2><a href="/pages/Bgr1h4kbMIZ70AOsfY4y">Exponential Moving Average</a></h2></td></tr><tr><td><a href="/pages/merlz4NIdO5k1iqFOWJr"><mark style="color:blue;"><code>er</code></mark></a></td><td><h2><a href="/pages/merlz4NIdO5k1iqFOWJr">Kaufman Efficiency Indicator</a></h2></td></tr><tr><td><a href="/pages/uq82T2UM3lnUckHYq9So"><mark style="color:blue;"><code>kama</code></mark></a></td><td><h2><a href="/pages/uq82T2UM3lnUckHYq9So">Kaufman's Adaptive Moving Average</a></h2></td></tr><tr><td><a href="/pages/EWVHpbKQpPGVMR2MibBi"><mark style="color:blue;"><code>kc</code></mark></a></td><td><h2><a href="/pages/EWVHpbKQpPGVMR2MibBi">Keltner Channels</a></h2></td></tr><tr><td><a href="/pages/Ntf6aWxoFfLbQe81qVAG"><mark style="color:blue;"><code>mobo</code></mark></a></td><td><h2><a href="/pages/Ntf6aWxoFfLbQe81qVAG">Momentum Breakout Bands</a></h2></td></tr><tr><td><a href="/pages/IDFcgiRW35TUjPKKNrDh"><mark style="color:blue;"><code>pivot</code></mark></a></td><td><h2><a href="/pages/IDFcgiRW35TUjPKKNrDh">Pivot Points</a></h2></td></tr><tr><td><a href="/pages/RA20PtnoXN0xLlcB6Lge"><mark style="color:blue;"><code>ppo</code></mark></a></td><td><h2><a href="/pages/RA20PtnoXN0xLlcB6Lge">Percentage Price Oscillator</a></h2></td></tr><tr><td><a href="/pages/Xw2exHata8b7BBCuPFXl"><mark style="color:blue;"><code>percent_b</code></mark></a></td><td><h2><a href="/pages/Xw2exHata8b7BBCuPFXl">Percent B</a></h2></td></tr><tr><td><a href="/pages/Yf15iIVpxiN2fEUogbBE"><mark style="color:blue;"><code>sar</code></mark></a></td><td><h2><a href="/pages/Yf15iIVpxiN2fEUogbBE">Stop-and-Reverse</a></h2></td></tr><tr><td><a href="/pages/gEJULbgGgZpWh0ndUWQj"><mark style="color:blue;"><code>stoch</code></mark></a></td><td><h2><a href="/pages/gEJULbgGgZpWh0ndUWQj">Stochastic Oscillator %K</a></h2></td></tr><tr><td><a href="/pages/DRrzOm9ipR4chBDdNyO3"><mark style="color:blue;"><code>stochrsi</code></mark></a></td><td><h2><a href="/pages/DRrzOm9ipR4chBDdNyO3">Stochastic RSI</a></h2></td></tr><tr><td><a href="/pages/SV9nD57s1GqKvmitDpAM"><mark style="color:blue;"><code>tr</code></mark></a></td><td><h2><a href="/pages/SV9nD57s1GqKvmitDpAM">True Range</a></h2></td></tr><tr><td><a href="/pages/3INuHpAvWWD5CDIqSjIR"><mark style="color:blue;"><code>trix</code></mark></a></td><td><h2><a href="/pages/3INuHpAvWWD5CDIqSjIR">Triple Exponential Moving Average Oscillator</a></h2></td></tr><tr><td><a href="#volume-adjusted-moving-average"><mark style="color:blue;"><code>vama</code></mark></a></td><td><h2><a href="/pages/ZpYXmXbQKuI5E6vnR1Wh"><mark style="color:blue;">Volume Adjusted Moving Average</mark></a></h2></td></tr></tbody></table>


# Relative Strenght Index

The Relative Strength Index (RSI) employed to identify shifts in momentum and the potential direction of asset prices.

<mark style="color:purple;">`rsi`</mark>([*<mark style="color:blue;">candles</mark>*](/function/functions/candles): *List*\[\[[*<mark style="color:blue;">Candle</mark>*](/function/structures#candle)]], *period*: *int* = 14, *column*: *str* = "*close*") -> *List*\[*Decimal*]

* Parameters:

  * *candles*: *List*\[\[[*<mark style="color:blue;">Candle</mark>*](/function/structures#candle)]]
  * *period*: *int, default 14*
  * *column: str, deafault 'close'*

  OHLCV - Open high low close
* **Returns: Decimal**

  Returns number, in range \[0,100], that indicates that the market is oversold or overbought.

<details>

<summary>Example:</summary>

</details>

## Relative Strenght Index (RSI)

Offering insights into the speed and extent of price movements to assess whether an asset is overbought or oversold. By gauging recent price changes, it provides valuable signals regarding the strength of a trend, aiding traders in making informed decisions.

Key Insights:

* the RSI helps traders detect bullish or bearish momentum
* A reading above 70 typically signals that an asset is overbought, while a reading below 30 suggests it is oversold.
* In certain market conditions, when the RSI crosses below the overbought level or above the oversold level, traders may interpret this as a signal to buy or sell.
* The RSI is most effective within trading ranges and less reliable in trending markets.

$$
\textbf{RSI}=100-\left( \frac{100}{1+\frac{\text{Average Gain}}{\text{Average Loss}}} \right)
$$

### How the RSI Functions:

The RSI compares the average strength of an asset’s price movements on up days to its strength on down days. By doing so, it provides a ratio that helps assess whether the security is experiencing an overextension in either direction. This comparison, when interpreted alongside price movements, offers traders a glimpse into potential future price behavior.

When used in conjunction with other technical indicators, the RSI can enhance a trader's ability to make informed decisions, refining entry and exit strategies.

The Significance of RSI:

* Trend Validation and Reversals: RSI aids traders in confirming prevailing trends and signaling potential reversals.
* Overbought and Oversold Conditions: It helps identify when securities may be excessively bought or sold, offering an early warning for price corrections.
* Short-Term Signals: For short-term traders, the RSI can serve as a valuable tool, providing actionable buy and sell signals.
* Complementary to Other Indicators: The RSI is most potent when used alongside other technical indicators, offering additional support to trading strategies.


# RSI to price

It yields the price at which the anticipated RSI value will be attained.

<mark style="color:purple;">`rsi_to_price`</mark>([*candles*](/function/functions/candles): *List*\[\[[*Candle*](/function/structures#candle)]], *rsi\_expected*: *float*, *period*: *int* = 14, *column*="*close*") -> *Decimal*

* **Parametres:**

  * **candles:** List\[\[[<mark style="color:blue;">Candle</mark>](/function/structures#candle)]]

  List of candles

  * **rsi\_expected:** float

  70 typically signals that an asset is overbought, below 30 suggests it is oversold.

  * **period:** int, default 14

  Period of RSI ema

  * **column:** str, default 'close'

  OHLC - Open high low close.
* **Returns:**
  * Price

<details>

<summary>Example</summary>

</details>

## [Relative Strenth Index (RSI)](/function/technical-analysis/relative-strenght-index) to price


# Average True Range

Learn how to use the Average True Range indicator in Origami Tech to measure price volatility and improve stop-loss and risk management.

<mark style="color:red;">`atr(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14) -> List[Decimal]`</mark>

## Average True Range (ATR)


# Bollinger Bands

Understand how Bollinger Bands in Origami Tech help detect volatility, breakout potential, and overbought or oversold market conditions.

<mark style="color:purple;">`bbands`</mark>([*candles*](/function/functions/candles): *List*\[\[[*Candle*](/function/structures#candle)]], *period*: *int* = 20, *multiplier*: *float* = 2, *column*: *str* = "*close*") -> *List*\[*BBANDS*]

* Parametrs:
  * *candles*: *List*\[\[[*Candle*](https://docs.origami.tech/function/structures#candle)]]
  * *period*: *int, default 20*
  * *multiplier*: *float, default 2*
  * *column: str, deafault 'close'*
    * OHCLV - open high close low
* *Returns:*
  * <mark style="color:red;">`BBANDS`</mark> this is object with fields <mark style="color:red;">`upper`</mark>, <mark style="color:red;">`middle`</mark>, <mark style="color:red;">`lower`</mark>

## Bollinger Bands

Bollinger Bands serve as a technical analysis tool used to identify when prices may be high or low in comparison to recent trends.

Constructing Bollinger Bands Bollinger Bands are created by plotting three lines based on the price movements of a security. The central line represents the intermediate-term trend, usually calculated as a 20-day simple moving average (SMA) of closing prices. The upper and lower bands are drawn at a set number of standard deviations above and below the central line, typically two standard deviations.

To calculate the bands, the number of periods used for the SMA and the standard deviation must be determined. The standard deviation indicates the degree of price variation, while the number of standard deviations determines how wide the bands are. Although settings can be customized, the standard setup of a 20-day SMA with two standard deviations is most common.

The upper band is calculated by adding two standard deviations to the central SMA, while the lower band is found by subtracting two standard deviations. The distance between the upper and lower bands varies depending on market volatility—when volatility increases, the bands widen, and when volatility decreases, the bands narrow.

### Key Takeaways

* Bollinger Bands are a technical analysis tool designed to assess the relative high and low of an asset’s price by examining its historical fluctuations.
* These bands consist of three lines: a central moving average, and an upper and lower band positioned at specific distances from this central line.
* The upper and lower bands are typically set at two standard deviations above and below the 20-day simple moving average (SMA).
* This construction provides a framework to measure market volatility and determine potential overbought or oversold conditions.

### The Role of Bollinger Bands

The bands are a direct reflection of the market’s price volatility. As volatility rises, the bands widen, indicating larger price fluctuations. Conversely, when volatility decreases, the bands contract, signaling a period of consolidation.

Traders often use Bollinger Bands to identify potential entry and exit points. When an asset’s price approaches or breaches the upper band, it may indicate that the asset is overbought and due for a price correction. Similarly, when the price nears the lower band, it suggests the asset may be oversold and a price rebound is likely.

### Understanding Moves Within the Bands

The construction of Bollinger Bands is grounded in the principles of statistical analysis, specifically the normal distribution. Standard deviation, a measure of how much a value deviates from its average, is used to define the distance between the bands.

The bands are typically set two standard deviations from the SMA, which theoretically contains 95% of an asset's price movements if the price distribution follows a normal curve. This statistical framework helps capture the majority of price fluctuations while accounting for typical volatility. The bands adjust dynamically to market changes, ensuring their relevance across different market conditions.

When prices breach the upper or lower bands, it suggests that the asset is trading at an extreme relative to its recent history. A breach of the upper band could signal an overbought condition, while a breach of the lower band may indicate an oversold condition. However, prices can remain outside these bands for extended periods during strong trends.

### Signals at the Upper Band

When the price reaches or exceeds the upper band, this can indicate that the asset is overbought, signaling a potential reversal or slowdown in momentum. This scenario often occurs when the price exceeds its typical trading range, suggesting that buyers may be exhausting their enthusiasm.

The movement of the price beyond the upper band also signifies heightened volatility. The widening of the bands indicates that price fluctuations have become more significant, often in response to news events, earnings reports, or shifts in market sentiment.

For traders employing mean reversion strategies, the upper band can serve as a price target. In markets without a clear trend, hitting the upper band could signal an opportunity to sell or short the asset, with the expectation that the price will move back toward the central band.

During a strong uptrend, it is not uncommon for the price to repeatedly touch or even stay above the upper band for extended periods. This persistent movement above the upper band may indicate sustained buying pressure and a continuation of the trend. However, confirmation from other indicators is recommended to ensure that the uptrend is not weakening.

The upper band can also serve as a potential breakout point. A price move that starts at the upper band and continues beyond it could indicate the beginning of a new trend, particularly if accompanied by increased trading volume.

### Signals at the Lower Band

The lower band of Bollinger Bands is used to identify oversold conditions. When the price touches or falls below the lower band, it may indicate that the asset is undervalued or that selling pressure has gone too far. This condition could lead to a price reversal or a pause in the downward trend.

Just as the upper band signifies increased volatility, the lower band marks greater volatility in the context of a downtrend. A price breach of the lower band could indicate that the asset is experiencing significant bearish sentiment.

For mean reversion traders, the lower band presents a potential buying opportunity. If the price has fallen to the lower band, it might rebound toward the central band or even higher, particularly in a market without a strong downtrend.

However, if the price stays below the lower band for an extended period, this could signal the onset of a stronger downtrend. Continued movement below the band may indicate that bearish momentum is likely to persist. Traders should confirm this signal with other indicators to avoid false signals.

A decisive move below the lower band, accompanied by high trading volume, could suggest the start of a new bearish trend, warranting a sell or short position.

### What Widening Bands Mean

When Bollinger Bands widen, it indicates an increase in volatility, as the price moves further away from the SMA. This heightened volatility can result from various factors, including economic news, earnings releases, or significant shifts in market sentiment.

Widening bands often signal the beginning of a major price trend. As volatility increases, the likelihood of sustained price movements in one direction also rises. Traders should confirm these signals with other technical indicators or price patterns before taking action.

Widening bands can also occur after a period of contraction, known as a "squeeze." A squeeze often precedes a breakout, although the direction of the breakout is uncertain. To gauge the potential direction, traders should monitor the price movement in relation to the bands and other technical indicators.

### What Tightening Bands Mean

A contraction of the bands suggests lower volatility, with price movements becoming more confined. Tightening bands indicate that market interest may be waning, and price fluctuations are becoming smaller.

Despite reduced volatility, tightening bands can be a precursor to major price movements or breakouts. Traders closely watch for a breakout after a period of tight bands, as these are often followed by strong trends in either direction.

Tightening bands also indicate uncertainty in the market. If prices remain within a narrow range, traders may wait for new information or a breakout event to trigger a more decisive price movement.

How Reliable are Bollinger Bands? The reliability of Bollinger Bands as a predictive tool depends on several factors:

* Asset Characteristics
  * Different assets exhibit varying degrees of volatility, affecting the utility of Bollinger Bands. Assets prone to sudden volatility spikes may behave unpredictably within the bands.
* Parameter Settings
  * The standard settings for Bollinger Bands are a 20-period SMA and bands placed at two standard deviations. However, these parameters can be adjusted depending on the asset or time frame being analyzed.
* Complementary Indicators
  * Bollinger Bands work best when used in conjunction with other technical indicators, such as volume or momentum oscillators like the RSI or MACD. These additional tools can help confirm signals and provide further context.
* Outlier Events
  * Bollinger Bands assume a normal distribution of price returns, but financial markets often experience "fat tails," where prices deviate significantly from the mean. In such cases, prices can breach the bands without indicating a reversal or significant change. Another strategy based on Bollinger Bands is the Bollinger Bounce, which involves buying or selling when the price rebounds from the upper or lower bands toward the central line. This strategy works well in ranging markets where prices oscillate between the bands without a clear trend.

In conclusion, while Bollinger Bands are a powerful tool for assessing market volatility and identifying potential entry and exit points, they should be used in conjunction with other indicators and analysis techniques to confirm trading signals and manage risk effectively.

Limitations of Using Bollinger Bands Bollinger Bands, while a valuable tool in technical analysis, do have several limitations that traders should be mindful of.

* First, they are a lagging indicator, meaning they react to price movements rather than predict them. As a result, they may signal changes only after the price has already begun to move, potentially causing traders to miss the optimal moment for action.
* Second, during periods of high market volatility, when the bands expand significantly, Bollinger Bands can sometimes produce false signals. In such times, price movements may breach the bands without indicating a true reversal, leading to misleading or premature conclusions.
* Third, the default settings of Bollinger Bands—using a 20-day simple moving average (SMA) and two standard deviations—may not be appropriate for every trading scenario. These settings, while effective in many cases, may need adjustment depending on the asset or market conditions being analyzed.
* Finally, while Bollinger Bands can provide useful insights, they are often more reliable when used in conjunction with other indicators, such as volume analysis or momentum oscillators. Relying solely on Bollinger Bands without additional confirmation can result in poor trading decisions, as they may not capture the full scope of market dynamics.

In short, while Bollinger Bands are a powerful tool for identifying price extremes and volatility, traders should use them with caution and in combination with other strategies to ensure more accurate predictions and sound decision-making.


# Donchian Channel

Donchian channels are a widely-used technical analysis tool, primarily employed to identify breakout points in price movements—critical for traders seeking to capture significant trends.

<mark style="color:purple;">`do`</mark>([*<mark style="color:blue;">candles</mark>*](/function/functions/candles): *List*\[\[[*<mark style="color:blue;">Candle</mark>*](/function/structures#candle)]], *upper\_period*: *int* = 20, *lower\_period*: *int* = 5) -> *List*\[\[*BBANDS*]]

* Parametrs:
  * *candles*: *List*\[\[[*Candle*](https://docs.origami.tech/function/structures#candle)]]
  * *upper\_period*: *int, default 20*
  * *lower\_period*: *int, default 5*
* *Returns:*
  * <mark style="color:red;">`BBANDS`</mark> this is object with fields <mark style="color:red;">`upper`</mark>, <mark style="color:red;">`middle`</mark>, <mark style="color:red;">`lower`</mark>

## Donchian Channel

Donchian Channels: A Key Tool for Identifying Breakout Points

### Key Takeaways

* Donchian channels are a popular tool, particularly among commodity traders.
* The channel consists of two boundary lines: the upper line, representing the highest price of a security over a set number of periods, and the lower line, representing the lowest price over the same period.&#x20;
* These channels are versatile, offering various practical applications for both traders and investors.&#x20;
* When combined with other technical indicators, such as moving averages, volume indicators, and the moving average convergence/divergence (MACD), Donchian channels can provide a more complete view of the market.&#x20;
* Donchian channels can help clarify trends and breakout signals, though their effectiveness depends on careful consideration of period length, market conditions, risk, and the integration with other indicators.

### Structure of Donchian Channels

The Donchian channel is formed by plotting two boundary lines. The upper line indicates the highest price of an asset over a defined period, while the lower line reflects the lowest price over the same period. The default setting is typically 20 periods, corresponding to the number of trading days in a month.

An optional middle line is often included, representing the average of the upper and lower boundaries. This tool is especially effective in trending markets, allowing traders to visualize price volatility and momentum.

When the price breaches the upper boundary, it may signal a buying opportunity, suggesting a bullish trend. Conversely, a break below the lower boundary can indicate a bearish signal, prompting a potential sell. However, in range-bound markets, Donchian channels can yield frequent false signals, making it essential to use them alongside other indicators to confirm trends and filter out noise.

### Calculating Donchian Channels

The key elements of Donchian channels are the upper band, the lower band, and, optionally, the middle band. The middle band is the average of the upper and lower bands. The primary variable is the period (N), which determines the channel's sensitivity. A smaller value for N makes the channel more responsive to price movements, while a larger N captures broader price trends. Traders typically use shorter periods for short-term trading and longer periods for long-term trend-following strategies.

#### Upper Band:

This is calculated by identifying the highest price of an asset over a specified number of periods (N).&#x20;

$$
\text{Upper}=\text{Highest High}\left( \text{N} \right)
$$

#### Lower Band:

This is the lowest price of the asset over the same number of periods (N).

$$
\text{Lower}=\text{Lowest Low}\left( \text{N} \right)
$$

#### Middle Band:

The average of the upper and lower bands.

$$
\text{Middle}=\frac{\text{Upper}+\text{Lower}}{2}
$$

### Practical Applications of Donchian Channels

Donchian channels serve a variety of purposes in technical analysis:

* Identifying Trends
  * Donchian channels are especially useful for identifying the prevailing market trend. When the price consistently trades near the upper band, it signals a strong uptrend, indicating bullish sentiment. Conversely, trading near the lower band signals a downtrend, reflecting bearish sentiment.
* Breakout Signals
  * Donchian channels excel at spotting breakout opportunities. A breakout above the upper band indicates potential for further price increases, while a break below the lower band may signal a selling or short-selling opportunity, suggesting the price will continue to decline.
* Support and Resistance Levels
  * The upper and lower bands often act as support and resistance levels. Traders monitor these levels closely to make buy or sell decisions. For example, a bounce off the lower band may suggest a buying opportunity, while resistance at the upper band could be a cue to sell.
* Stop-Loss and Exit Points
  * Donchian channels are useful for setting stop-loss orders and determining exit points. For instance, placing a stop-loss just below the lower band when buying can help limit potential losses if the market moves unfavorably.
* Volatility Measure
  * The width of the Donchian channel can serve as an indicator of market volatility. A wider channel indicates higher volatility, as the price fluctuates more dramatically over the defined period, while a narrower channel suggests lower volatility.
* Filtering Market Noise
  * For longer-term trading strategies, setting a longer period for the Donchian channel can help filter out market noise, allowing traders to focus on significant price movements.

### Integrating Donchian Channels with Other Indicators

To strengthen trading strategies, Donchian channels can be combined with other technical analysis tools. When used in conjunction with the Relative Strength Index (RSI), moving averages, or MACD, Donchian channels can provide a more comprehensive understanding of market trends and help confirm breakout signals.

### Factors to Consider When Using Donchian Channels

* Selecting the Period Length
  * The default period setting is 20, but traders may adjust this to suit their strategy. Shorter periods are more responsive to recent price moves, ideal for short-term trading, while longer periods smooth price data, making them better for long-term trend-following strategies.
* Market Conditions
  * Donchian channels are most effective in trending markets. In range-bound or sideways markets, they may generate frequent false signals. Thus, traders must consider overall market conditions and may use other indicators to determine the market phase.
* Risk Management
  * Risk management is crucial in trading. Donchian channels can help set stop-loss orders strategically, either at the lower band for long positions or the upper band for short positions, to mitigate potential losses.
* Combining with Other Indicators
  * To confirm signals and reduce the likelihood of false breakouts, it is beneficial to use Donchian channels alongside other technical indicators such as RSI, MACD, or moving averages. This approach provides a more comprehensive market view.
* False Breakouts
  * A challenge with Donchian channels is the risk of false breakouts. The price may break through a boundary only to reverse direction shortly after, leading to misleading signals. Traders must be cautious and prepared for these potential reversals.
* Adjusting for Different Assets
  * Each asset behaves differently, so it is essential to adjust the Donchian channel settings according to the characteristics of the specific asset or market.
* Market Context
  * Donchian channels focus solely on price data and do not consider broader economic factors, news events, or market sentiment. Therefore, they should be used in conjunction with a broader analysis that takes into account these additional influences.

### Limitations and Risks of Donchian Channels

Donchian channels have inherent limitations and risks:

* Lagging Indicator
  * Since Donchian channels are based on historical price data, they react to price movements rather than predicting them, leading to potential delays in entry and exit signals.
* False Breakouts
  * False breakouts are a significant risk, as the price may briefly breach a band before reversing direction, leading to premature trading decisions.
* Sideways Markets
  * In range-bound or sideways markets, Donchian channels may produce frequent false signals, resulting in potential losses.
* Overreliance
  * Relying solely on Donchian channels for trading decisions can be risky. They should be used in conjunction with other tools and strategies for more accurate market analysis.
* Improper Period Settings
  * The effectiveness of Donchian channels depends on the period setting (N). An incorrect setting may lead to ineffective or misleading signals, depending on market conditions and asset characteristics.
* Market Context
  * Donchian channels do not take into account broader market conditions or external factors like economic data or news events, which may significantly impact asset prices.

### Understanding the Reliability of Donchian Channels

The reliability of Donchian channels, like any technical analysis tool, varies depending on the market conditions, asset types, and the way they are incorporated into a broader trading strategy. While they are useful for identifying trends and breakouts, traders must be mindful of their limitations and combine them with other indicators and sound trading practices for a more holistic approach.


# Exponential Moving Average

The Exponential Moving Average in Origami Tech applies weighted smoothing to price data, ideal for momentum and crossover strategies.

## [Exponential Moving Average](/function/technical-analysis#exponential-moving-average)

<mark style="color:red;">`ema(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14, column: str = "close") -> List[Decimal]`</mark>


# Kaufman Efficiency Indicator

Learn how to use the Kaufman Efficiency Indicator in Origami Tech to measure trend efficiency and identify stable, low-noise market conditions.

## [Kaufman Efficiency Indicator](/function/technical-analysis#kaufman-efficiency-indicator)

<mark style="color:red;">`er(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14, column: str = "close") -> List[Decimal]`</mark>


# Kaufman's Adaptive Moving Average

Learn how Kaufman’s Adaptive Moving Average in Origami Tech adapts to market noise, providing smoother and more accurate trend tracking.

## [Kaufman's Adaptive Moving Average](/function/technical-analysis#kaufmans-adaptive-moving-average)

<mark style="color:red;">`kama(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], er: int = 10, fast: int = 2, slow: int = 30, period: int = 20, column: str = "close") -> List[Decimal]`</mark>


# Keltner Channels

Explore Keltner Channels in Origami Tech to analyze volatility and trend direction, enhancing entry and exit conditions in trading strategies.

## [Keltner Channels](/function/technical-analysis#keltner-channels)

<mark style="color:red;">`kc(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 20, atr_period: int = 10, kc_mult: float: 2) -> List[KC]`</mark>

where <mark style="color:red;">`KC`</mark> this is object with fields <mark style="color:red;">`upper`</mark>, <mark style="color:red;">`lower`</mark>


# Momentum Breakout Bands

Learn how Momentum Breakout Bands in Origami Tech detect volatility expansion and breakout conditions for active trading strategies.

## [Momentum Breakout Bands](/function/technical-analysis#momentum-breakout-bands)

<mark style="color:red;">`mobo(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 10, multiplier: float = 0.8, column: str = "close") -> List[[ BBANDS ]]`</mark>


# Pivot Points

Pivot Points in Origami Tech calculate potential support and resistance levels to optimize trading entry and exit points automatically.

## [Pivot Points](/function/technical-analysis#pivot-points)

<mark style="color:red;">`pivot(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]]) -> List[Pivot]`</mark>

where <mark style="color:red;">`Pivot`</mark> this is object with fields: `pivot`, <mark style="color:red;">`s1`</mark>, <mark style="color:red;">`s2`</mark>, <mark style="color:red;">`s3`</mark>, <mark style="color:red;">`s4`</mark>, <mark style="color:red;">`r1`</mark>, <mark style="color:red;">`r2`</mark>, <mark style="color:red;">`r3`</mark>, <mark style="color:red;">`r4`</mark>


# Percentage Price Oscillator

Explore how the Percentage Price Oscillator in Origami Tech tracks the difference between moving averages to gauge market momentum.

## [Percentage Price Oscillator](/function/technical-analysis#percentage-price-oscillator)

<mark style="color:red;">`ppo(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], fast: int = 12, slow: int = 26, signal: int = 9, column: str = "close") -> List[PPO]`</mark>

where <mark style="color:red;">`PPO`</mark> this is object with fields: <mark style="color:red;">`ppo`</mark>, <mark style="color:red;">`signal`</mark>, <mark style="color:red;">`histogram`</mark>


# Percent B

Understand the Percent B indicator in Origami Tech, which measures price relative to Bollinger Bands to signal overbought or oversold zones.

## [Percent B](/function/technical-analysis#percent-b)

<mark style="color:red;">`percent_b(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14, colum: str = "close") -> List[Decimal]`</mark>


# Stop-and-Reverse

Learn how to use the Stop and Reverse (SAR) indicator in Origami Tech to detect potential trend reversals and manage automated trading positions.

## [Stop-and-Reverse](/function/technical-analysis#stop-and-reverse)

<mark style="color:red;">`sar(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], af: float = 0.02, amax: float = 0.2) -> List[Decimal]`</mark>


# Stochastic Oscillator %K

The Stochastic Oscillator %K in Origami Tech measures momentum by comparing closing prices to recent ranges for trading signal generation.

## [Stochastic Oscillator %K](/function/technical-analysis#stochastic-oscillator-k)

<mark style="color:red;">`stoch(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14) -> List[Decimal]`</mark>


# Stochastic RSI

Learn how the Stochastic RSI indicator in Origami Tech combines RSI and stochastic methods to identify market momentum and overbought conditions.

## [Stochastic RSI](/function/technical-analysis#stochastic-rsi)

<mark style="color:red;">`stochrsi(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], rsi_period: int = 14, stoch_period: int = 14) -> List[Decimal]`</mark>


# True Range

The True Range indicator in Origami Tech measures intraday volatility, helping traders set dynamic stop levels and assess price movement.

## [True Range](/function/technical-analysis#true-range)

<mark style="color:red;">`tr(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]]) -> List[Decimal]`</mark>


# Triple Exponential Moving Average Oscillator

Explore the TEMA Oscillator in Origami Tech, designed to minimize lag and enhance signal precision in momentum-based trading systems.

## [Triple Exponential Moving Average Oscillator](/function/technical-analysis#triple-exponential-moving-average-oscillator)

<mark style="color:red;">`trix(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14, column: str = "close") -> List[Decimal]`</mark>


# Volume Adjusted Moving Average

Explore how the Volume Adjusted Moving Average in Origami Tech smooths trends by weighting prices with traded volume for accurate signal detection.

## [Volume Adjusted Moving Average](/function/technical-analysis#volume-adjusted-moving-average)

<mark style="color:red;">`vama(`</mark>[<mark style="color:blue;">`candles`</mark>](/function/functions/candles)<mark style="color:red;">`: List[[`</mark>[<mark style="color:blue;">`Candle`</mark>](/function/structures#candle)<mark style="color:red;">`]], period: int = 14, column: str = "close") -> List[Decimal]`</mark>


# Structures

The type and format of the returned data by the functions.

| <h2><a href="/pages/mNaQxvV1ODnFvuGZpUuf"><mark style="color:blue;">Balance</mark></a></h2>       | [<mark style="color:blue;">`balance`</mark>](/function/functions/balance); [<mark style="color:blue;">`saved_balance`</mark>](/function/functions/saved-balance) |
| ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <h2><a href="/pages/qGCniJ0oiSNXH59lDfoN"><mark style="color:blue;">GroupBalance</mark></a></h2>  | [<mark style="color:blue;">`group_balance`</mark>](/function/functions/group-balance)                                                                            |
| <h2><a href="/pages/AVpLEudbWCHaLDLJPF0o"><mark style="color:blue;">Orderbook</mark></a></h2>     | [<mark style="color:blue;">`orderbook`</mark>](/function/functions/orderbook); [<mark style="color:blue;">`own`</mark>](/function/functions/own)                 |
| <h2><a href="/pages/OY2NzCnVwZoLxbELUWz2"><mark style="color:blue;">OrderbookUnit</mark></a></h2> | [<mark style="color:blue;">Orderbook</mark>](/function/structures/orderbook)                                                                                     |
| <h2><a href="/pages/sUiJgz3vLYeR8qReYyDq"><mark style="color:blue;">Symbol</mark></a></h2>        | [<mark style="color:blue;">`symbol`</mark>](/function/functions/symbol)                                                                                          |
| <h2><a href="/pages/Xvc8UiJyVJn1I8gx8cUT"><mark style="color:blue;">Candle</mark></a></h2>        | [<mark style="color:blue;">`candles`</mark>](/function/functions/candles)                                                                                        |

***


# Balance

The Balance structure in Origami Tech defines account assets, quantities, and valuation, essential for portfolio and strategy calculations.

<details>

<summary><a href="/pages/6TLh3HSmDezVNwXYXgw3#balance"><mark style="color:red;"><code>Balance</code></mark></a></summary>

<mark style="color:red;">`Balance.available [decimal]`</mark> amount for tokens available at the time of calculating grid

<mark style="color:red;">`Balance.reserved [decimal]`</mark> amount for tokens reserver *(ex: orders already placed)* at the time of calculating grid

<mark style="color:red;">`Balance.total [decimal]`</mark> amount of tokens on the account (Balance.available + Balance.reserved) at the time of calculating grid

</details>


# GroupBalance

The GroupBalance structure in Origami Tech defines grouped balance data for multi-account tracking, reporting, and portfolio management.

<details>

<summary><a href="/pages/6TLh3HSmDezVNwXYXgw3#groupbalance"><mark style="color:red;"><code>GroupBalance</code></mark></a></summary>

<mark style="color:red;">`GroupBalance.start [[`</mark>[<mark style="color:blue;">`Balance`</mark>](/function/structures#balance)<mark style="color:red;">`]]`</mark> saved balance

<mark style="color:red;">`GroupBalance.current [[`</mark> [<mark style="color:blue;">`Balance`</mark>](/function/structures#balance) <mark style="color:red;">`]]`</mark> current balance of group

</details>


# GroupBalance

<details>

<summary><a href="/pages/6TLh3HSmDezVNwXYXgw3#groupbalance"><mark style="color:red;"><code>GroupBalance</code></mark></a></summary>

<mark style="color:red;">`GroupBalance.start [[`</mark>[<mark style="color:blue;">`Balance`</mark>](/function/structures#balance)<mark style="color:red;">`]]`</mark> saved balance

<mark style="color:red;">`GroupBalance.current [[`</mark> [<mark style="color:blue;">`Balance`</mark>](/function/structures#balance) <mark style="color:red;">`]]`</mark> current balance of group

</details>




---

[Next Page](/llms-full.txt/1)

