What is Declare Variable in FYERS Automate, and when should I use it?

What is Declare Variable in FYERS Automate, and when should I use it?

Declare Variable is used when a strategy needs to capture or calculate a value at one point in the workflow and reuse that same result later. It calculates once and keeps its data source values and calculated outputs fixed for the rest of that workflow run.

Use it for a saved snapshot rather than a continuously refreshed condition.


When should I use Declare Variable?

Use Declare Variable when you need to:

  • Capture LTP when the automation starts.
  • Remember a selected option contract for the current run.
  • Save the combined premium at a specific time.
  • Calculate and save a percentage above or below a captured value.
  • Calculate an average at market open and keep that result unchanged.
  • Pass a saved calculated result to later parts of the workflow.
Tip: Declare Variable is like a snapshot. It captures the required value at that point rather than continuing to refresh it.

Can Declare Variable perform calculations?

Yes.

Declare Variable can:

  • Fetch data from one or more data sources.
  • Use supported functions.
  • Perform arithmetic.
  • Build calculations in several steps.
  • Pass a calculated value or selected symbol into later logic.

You should not choose Declare Variable simply because the strategy uses mathematics. Expression Builder also supports calculations.

The deciding factor is whether the result should remain fixed or live.

Example: Capture a starting price

“Alert when the live price is at least 10% above the price when the automation started.”

The workflow needs two different types of values:

  1. Declare Variable captures the starting LTP.
  2. Expression Builder reads the live LTP.
  3. The captured LTP remains fixed while the live LTP continues to change.

What If?

ScenarioWhat to do
What if the value should refresh each time the condition is checked?Use Expression Builder.
What if I select the highest-OI option at 9:20 AM and want to keep monitoring that same contract?Use Declare Variable to save the selected symbol, then use that symbol in later live checks.
What if another option later becomes the highest-OI contract?The saved symbol does not change during that workflow run because the Declare Variable result is already frozen.
What if the automation runs again?Declare Variable calculates again when the node executes in the new workflow run.

Last updated: 26 Aug 2026