Trend / MA stack — learning guide
What this trading process is for
The Trend / MA stack template is a classic trend-following decision flow for forex. It does not predict reversals; it waits until moving averages and price agree on direction, then issues a buy or sell intent. When the picture is messy—short and long MAs cross frequently, or price chops around the long EMA—the flow falls through to hold, which is intentional: the process is designed to reduce trades in unclear conditions.
In JayBot’s J-Trading flow diagram, each box is a node. Conditions read market context (prices, MAs, EMA). Actions emit buy, sell, or hold. Edges labelled true or false show which path runs after a test. Nothing here is investment advice; it is a structured way to express rules the engine can evaluate tick by tick.
How the diagram is wired
Execution starts at start, then visits trend_up, a condition that uses the ma_cross evaluator: it compares a short moving average to a long one (default periods 20 and 50). If short is greater than long (compare: gt), the branch is interpreted as upward momentum in that simple sense, and the flow moves along the true edge to price_above_ema. If not, the false edge sends you to trend_down, which uses the same MA pair but asks whether short is less than long—downward bias.
From there, the flow requires confirmation against a slow EMA (default 200). price_above_ema checks whether price is above that EMA (op: gt); price_below_ema checks below (op: lt). Only when both the MA stack and the EMA filter agree does the flow reach a directional buy or sell action. Any failure along the way routes to hold.
This two-stage design—directional filter then slow-trend filter—is common in systematic trading: the fast structure catches the idea of “which way might the wind blow,” while the EMA filter tries to avoid fading a strong longer-term trend.
Tunable parameters and what they change
- short_period and long_period (on ma_cross nodes): Control how reactive the trend signal is. Shorter pairs react faster but generate more noise; longer pairs are smoother but slower. Changing them shifts when the tree decides “uptrend” or “downtrend” is present.
- compare (
gt/lt): Normally left on defaults; swapping would invert the logic of which branch is “up” vs “down” for that node—usually you should not flip these unless you are deliberately redesigning the flow. - period on price_vs_ema nodes: The default 200 is a widely used long-term smoothing window. Lower values make the EMA filter more sensitive; higher values make it slower. A very small period can make the “confirmation” step behave almost like another fast MA, weakening the original design intent.
- op on price_vs_ema: gt means “price must be above EMA” for the bullish leg; lt for the bearish leg. These should stay paired with the correct branch; editing them without understanding the graph can route buys into logically inconsistent paths.
When you edit values in the interactive playground, you are not editing JayBot’s canonical system template on disk. You are building a configuration that can be saved as a preset version and later applied to your own row under Trading strategies (a user-owned strategy whose rules_json includes metadata.template_id).
Mean reversion vs this template
Mean-reversion systems often buy dips and sell rips. This template is the opposite philosophy: it buys strength in an uptrend (as defined by the nodes) and sells weakness in a downtrend. If you run it in a tight range, you should expect many hold outcomes—that is a feature, not a bug, unless you intentionally narrow filters to force more activity (which usually increases churn and sensitivity to spread and latency).
Presets, versions, and “Trading processes”
Under Strategy management, your own saved flows appear under Trading processes. A preset here is a named line of versions for a single built-in template id (e.g. trend_ma). Each version stores the merged rules_json (template + your overrides) and the overrides map for audit. You can load an older version into the playground, tweak again, and save a new version—linear version history, not Git branches.
Apply creates a new strategy or updates one you already own. The engine still reads your strategies table; the built-in template files remain read-only.
Risks and limitations
Past behaviour of MAs does not guarantee future prices. Spreads, slippage, session gaps, and news can invalidate assumptions embedded in any static flow. Use the AI explanation panel as an educational summary of what changed relative to defaults, not as a recommendation to trade. AI calls consume credits from your balance like other OpenAI features in JayBot.
Suggested learning path
- Read this page once without touching the diagram.
- Open the playground, double-click each condition and action, and map the fields to this text.
- Change one parameter at a time (e.g. EMA period), save a preset version, and use Test elsewhere if you evaluate flows with sample context.
- When satisfied, Apply to a dedicated user strategy name (e.g. “EURUSD trend MA — my thresholds”) and enable it only when you understand the behaviour.
Practical checklist before you apply
Ask yourself: Which session will this run in, and what spread is typical on your symbols? Trend followers often underperform when spread is wide relative to the average bar range. If you shorten MA periods aggressively, count how often the flow would have flipped from buy to hold on recent historical data (outside JayBot if needed). If you lengthen periods, check whether entries become so rare that the strategy never participates in moves you care about. The flow diagram is only as sensible as the numbers you choose; versioning exists precisely so you can revert to an earlier preset after an experiment. Keeping a short note in the preset name (e.g. “wider EMA, Jan”) makes it easier to remember why a version exists months later. Revisit presets after major macro events: a configuration that behaved calmly for months can behave differently when volatility regimes shift, not because the JSON broke but because markets did.
This guide is for education inside JayBot. It is not financial advice.