Blog

Every indicator parameter can be a wire, not a typed-in number

TradeSmithy Team3 min read

Most visual builders treat an indicator's settings as a form: you pick RSI, you type 14 into a box, and 14 is baked into the exported code forever. Changing it means opening the builder, editing the field and exporting again.

That is a reasonable default and a bad ceiling. In TradeSmithy, every numeric indicator parameter is also an input port — something you can connect a wire to.

What a wired parameter buys you

Connect an RSI node's period port to a Global Parameter node and the period stops being a literal in the generated source. It becomes an input in the exported EA:

input int RsiPeriod = 14;

Which means:

  • It appears in the EA's Inputs tab in MetaTrader. You can change it per chart, without regenerating anything.
  • It becomes a variable the Strategy Tester can optimise over, once you have a range to sweep.
  • One parameter can feed several nodes. Wire the same AtrPeriod into your ATR-based stop and your ATR-based position sizing and they cannot drift apart, because there is only one value.

You are not limited to parameters. A port can equally take a variable (something the strategy computes and keeps between ticks) or the output of a math node. "Use a period of half the higher-timeframe lookback" is a wire, not a constant you have to work out and type in.

Which parameters get a port, and which do not

Every int and double parameter has one. Enums do not — and the reason is worth stating, because it looks like an inconsistency.

An enum parameter is not a number. MODE_SMA, PRICE_TYPICAL and VOLUME_TICK are named MQL constants, and there is no safe cast from an arbitrary wired value to one of them. A port there would let you connect a calculation producing 7 to a field that accepts four specific symbols, and the result would be code that compiles into something nobody chose. So a smoothing method stays a dropdown.

The typed value is never destroyed

Wiring a port does not overwrite the number you had typed. The generated code uses the wire; the value sits underneath, untouched. Unplug the wire and the parameter goes straight back to the value it had before — no re-typing, no lost work.

This is the same rule the rest of the app follows. A platform switch does not rewrite your graph, it flags the conflicts. A plan downgrade does not lock or delete a project, it only stops you creating the next one. Nothing here deletes your work to make a state change simpler to implement.

Names are checked as identifiers, because they become identifiers

A global parameter's name goes straight into a declaration in the exported source, so it is validated as what it becomes: it must match [A-Za-z_][A-Za-z0-9_]*, be 63 characters or fewer, not collide with an MQL reserved word, and be unique across the graph.

my stop, 2fast and double are all rejected in the panel. Without that check they reach the generator and produce an EA that will not compile — after the generation has been spent. Duplicates matter for a subtler reason: two parameters sharing a name do not compile either, which is why the check is over the whole set rather than one node at a time.

Where this is going

Parameter optimization is in development, and this is the groundwork for it. An optimizer needs two things: parameters that are actually exposed rather than baked in, and a sensible range for each one to search. Wired parameters give the first; the ranges already carried by every parameter in the indicator registry give the second.

Building the strategy with its parameters wired is therefore worth doing now even if you only ever adjust them by hand in the terminal — the same graph becomes optimisable later without being rebuilt.

Keep reading

← More from the TradeSmithy blog