---
id: faq_item.1312
page_type: faq_article
title: "What types of formulas can be written in the CustomEMA and SellByCustomEMA parameter fields?"
description: "The following formulas can be written in the CustomEMA and SellByCustomEMA parameter fields: EMA(X,Y) > or < A: Comparison of prices for EMA X seconds, minutes..."
section: faq
category: "Strategy settings"
url: https://moonbot.pro/faq/strategy-settings/1312?format=md
locale: en
alternate_ru: https://moonbot.pro/ru/faq/strategy-settings/1312?format=md
alternate_zh: https://moonbot.pro/zh/faq/strategy-settings/1312?format=md
parent: https://moonbot.pro/faq/strategy-settings?format=md
previous: https://moonbot.pro/faq/strategy-settings/1311?format=md
next: https://moonbot.pro/faq/strategy-settings/1313?format=md
status: published
updated_at: 2026-11-19T15:11:52+03:00
---

# What types of formulas can be written in the CustomEMA and SellByCustomEMA parameter fields?

The following formulas can be written in the CustomEMA and SellByCustomEMA parameter fields:

EMA(X,Y) > or \< A: Comparison of prices for EMA X seconds, minutes or hours ago and EMA Y seconds, minutes or hours ago (allowed values X=1s...300s or 2m...90m or 1h...41h, Y=1s...300s or 2m...90m or 1h...41h)

MAX(X,Y) > or \< A: Comparison of maximum price of X minutes or hours ago and EMA of Y seconds, minutes or hours ago. Valid values X=5m...90m or 1h...41h, Y=1s...300s or 2m...90m or 1h...41h.

MIN(X,Y) > or \< A: Comparison of the minimum price of X minutes or hours ago and the EMA of Y seconds, minutes or hours ago. Valid values X=5m...90m or 1h...41h, Y=1s...300s or 2m...90m or 1h...41h.

BTC(X,Y) > or \< A: Comparing BTC/USDT prices over EMA X seconds, minutes or hours ago and EMA Y seconds, minutes or hours ago (allowed values X=1s...300s or 2m...90m or 1h...41h, Y=1s...300s or 2m...90m or 1h...41h).

MAvg(X,Y) > or \< A: Comparison of average prices of the whole market(market) for EMA X seconds, minutes or hours ago and EMA Y seconds, minutes or hours ago (valid values X=1s...300s or 2m...90m or 1h...41h, Y=1s...300s or 2m...90m or 1h...41h).\
Two settings affect the calculation of the average market price:\
1\) On the Settings - Main tab, "Black List" and "Exclude from delta" - if the checkboxes are selected, Black List markets will be excluded from the average market price.\
2\) On the Settings - Advanced - Engine settings tab, "Weighted mAvg" - if the checkbox is ticked, the market price is taken on average with a weight equal to the daily volume.\
In other words, the lower the daily volume of a coin, the less it affects the average. The calculation can be compared to capitalisation: it is the sum (price \* volume).

Avg(X,Y) > or \< A: entry by analogy with EMA(X, Y). The price X seconds or minutes ago is compared with the price Y seconds or minutes ago.\
If Y=1, the current price is taken. The average price line (Avg Price) can be seen on the coin chart if you right-click on the "Show Spot trades\\OrderBook" button (to the right of the M button) and then check the "Avg Price" box.

Vol(X,Y) > or \< A: volume comparison formula. X and Y can only be one of these fixed values: 5s, 15s, 30s, 1m, 3m, 5m, 15m, 30m, 1h, 3h, 24h.\
The calculation is performed using the formula: (average minute volume for time Y) divided by (average minute volume for time X).\
Example: Volume for an hour is 120,000 USDT (the average minute volume for an hour will be 2,000).\
Volume for the last minute: 4,000 USDT\
Then Vol(1h,1m) = 4000/2000 = 2, i.e. the volume in this minute is 2 times greater than the average minute volume for the last hour.

Special case: if Vol(0,Y), then it simply gives the average minute volume for the time Y, without comparison to another interval.

Each formula (X,Y) > or \< A means:

1\) X,Y - time: a number followed by the letter s or m or h (seconds, minutes, hours respectively) or no letter (then the number is considered to be seconds).

2\) Sign > (more) or \< (less)

3\) A - the number to compare to, in per cent (can be positive, negative, integer or fractional with a "dot" separator, e.g.: 1 / -2 / 0.5 / -1.7)

Example of writing formulas: \
EMA(15m,1)>0.5 \
MAX(5m,2)\<-1 \
MIN(30m,1)>2 \
BTC(1h,10)\<3.3 \
MAvg(90m,5m)>-0.1\
Avg(5m,1)>1\
Vol(1h,1m)>2

## Navigation

Path: [Main](https://moonbot.pro/?format=md) / [FAQ](https://moonbot.pro/faq?format=md) / [Strategy settings](https://moonbot.pro/faq/strategy-settings?format=md) / What types of formulas can be written in the CustomEMA and SellByCustomEMA parameter fields?

Parent section: [Strategy settings](https://moonbot.pro/faq/strategy-settings?format=md)

Previous: [In which parameters are EMA formulas used?](https://moonbot.pro/faq/strategy-settings/1311?format=md)

Next: [What affects the calculation of MAvg, the average market price?](https://moonbot.pro/faq/strategy-settings/1313?format=md)

## Related

- [What affects the calculation of MAvg, the average market price?](https://moonbot.pro/faq/strategy-settings/1313?format=md)
- [What do the common values that are written in the parameter formula mean, for example, for EMA(X,Y)>A?](https://moonbot.pro/faq/strategy-settings/1314?format=md)
- [What is the methodology used to calculate and limit the EMA intervals?](https://moonbot.pro/faq/strategy-settings/1315?format=md)
- [Can I visually see the calculated points of the EMA parameters on a chart?](https://moonbot.pro/faq/strategy-settings/1316?format=md)
- [Is it possible to implement Trailing Buy functionality in the Moonbot terminal?](https://moonbot.pro/faq/strategy-settings/1317?format=md)
