Charts
DataOn-chain
VIP
Market Cap
API
Rankings
CoinOSNew
CoinClaw🦞
Language
  • 简体中文
  • 繁体中文
  • English
Leader in global market data applications, committed to providing valuable information more efficiently.

Features

  • Real-time Data
  • Special Features
  • AI Grid

Services

  • News
  • Open Data(API)
  • Institutional Services

Downloads

  • Desktop
  • Android
  • iOS

Contact Us

  • Chat Room
  • Business Email
  • Official Email
  • Official Verification

Join Community

  • Telegram
  • Twitter
  • Discord

© Copyright 2013-2026. All rights reserved.

简体繁體English
|Legacy

AIScript Beginner's Guide - Creating Your First Custom Indicator

CN
AiCoin研究院
Follow
1 year ago
AI summarizes in 5 seconds.

Script Editor

The script editor is where you write and debug AIScript code. While you can write code in any text editor, this editor offers some special features:

  • It highlights AIScript syntax, making it easier for you to read the code.
  • Relevant tips will be displayed when you hover over certain code.
  • The process of writing, compiling, and running code is very convenient; when you save the code, the script will immediately update on the chart.

To open the script editor, click on the "Custom Indicators/Live/Backtest" option at the bottom of the page. This will open a script editing window.

AIScript Beginner's Guide - Create Your First Custom Indicator_aicoin_figure1​​​​​​​

Your First Custom Indicator

Next, we will create a simple AIScript indicator. This indicator will simulate a simple moving average:

// @version=2

length = 14

maVal = ma(close, length)

plot(maVal, color = 'green')

​​​​​​

  • First, click the "New" menu in the upper right corner of the editor.
  • Copy the example code above.
  • Select all the default code displayed in the editor and replace it with the example code.
  • Click the "Save" button and give your script a name. Your script is now saved in the cloud and is only visible to you.
  • Click the "Add to Chart" button. You will see a green simple moving average on the chart.

Your first custom AIScript indicator is now running on the chart. Each line of code is explained as follows:

Line 1: // @version=2

This is a comment used to indicate to the compiler that this script uses version 2 of AIScript.

Line 2: length = 14

Defines a variable length, representing the time period for the moving average.

Line 3: maVal = ma(close, length)

Calculates the simple moving average (MA) of the closing price.

Line 4: plot(maVal, color = 'green')

Uses the plot function to draw maVal and sets the color to green.


Next, you can visit our Next Steps page to continue learning.

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

交易抽顶奢帐篷,赢小米新 SU7!
广告
|
|
APP
Windows
Mac
Share To

X

Telegram

Facebook

Reddit

CopyLink

|
|
APP
Windows
Mac
Share To

X

Telegram

Facebook

Reddit

CopyLink

Selected Articles by AiCoin研究院

7 hours ago
Big pullback in the cryptocurrency market? I quickly bought oil with one click! Come experience the cross-border joy of Aster!
1 day ago
Today, extreme fear (Fear & Greed Index dropped to 8-25)
4 days ago
How to automatically capture large orders using CoinClaw? Live operation at 17:00 today!
View More

Table of Contents

|
|
APP
Windows
Mac
Share To

X

Telegram

Facebook

Reddit

CopyLink

Related Articles

avatar
avatarAiCoin研究院
7 hours ago
Big pullback in the cryptocurrency market? I quickly bought oil with one click! Come experience the cross-border joy of Aster!
avatar
avatarAiCoin研究院
4 days ago
After ten years of trading cryptocurrencies, is there no opportunity left in the crypto market? Will you turn to the US stock market?
avatar
avatarAiCoin研究院
5 days ago
Trump turns against! BTC makes a fortune, only 60 hours left.
avatar
avatarAiCoin研究院
7 days ago
The large pancake has fallen below 70,000, this "airdrop raid" has violently recovered! Are you ready?
avatar
avatarAiCoin研究院
11 days ago
Who was selling during the plummet last night?
APP
Windows
Mac

X

Telegram

Facebook

Reddit

CopyLink