JSON Export Inverts Indicator Conditions

I want to flag a bug I’ve discovered in the JSON export functionality for signal bots that I believe needs urgent attention, as it affects the reliability of bot backups and imports.

When exporting a signal bot configuration to JSON, several indicator conditions are being inverted in the exported file compared to what is configured in the UI. Specifically, ‘Greater Than’ conditions export as ‘lt’ (less than) and ‘Lower Than’ conditions export as ‘gt’ (greater than) for price-vs-MA comparisons. Additionally, exit conditions appear to have the same inversion problem.

Here is a concrete example from my own bot export:

  1. Entry Group 1, EMA 100 vs Price:

    • UI shows: Current Price GREATER THAN EMA 100
    • JSON exports as: “indicatorCondition”: “lt”
    • Should be: “indicatorCondition”: “gt”
  2. Entry Group 2, Price vs EMA 21:

    • UI shows: Current Price GREATER THAN EMA 21
    • JSON exports as: “indicatorCondition”: “lt”
    • Should be: “indicatorCondition”: “gt”
  3. Entry Group 2, Price vs EMA 100:

    • UI shows: Current Price GREATER THAN EMA 100
    • JSON exports as: “indicatorCondition”: “lt”
    • Should be: “indicatorCondition”: “gt”
  4. Exit Group, Price vs EMA 100:

    • UI shows: Current Price LOWER THAN EMA 100
    • JSON exports as: “indicatorCondition”: “gt”
    • Should be: “indicatorCondition”: “lt”

This is particularly concerning because:

  • Users relying on JSON exports as backups will unknowingly restore bots with inverted logic
  • A bot configured to only enter when price is ABOVE a moving average would be incorrectly imported as entering when price is BELOW it — the opposite signal
  • This could cause significant financial losses if a user restores from a JSON backup and runs it live without re-verifying every condition in the UI

I discovered this by carefully cross-referencing my exported JSON against my known UI configuration. The backtest results confirmed the UI was correct and the JSON was not.

My suggestion for a fix:

  • Audit the JSON serialisation logic for all MA price comparison indicators
  • Add a validation step on import that warns users if imported conditions appear inconsistent
  • Consider adding a human-readable label field to each exported indicator so users can verify intent at a glance (e.g. “price above EMA 100” rather than just “lt”/“gt” codes)
  • Provide a JSON schema or documentation that clearly defines what each condition code means so users can manually verify exports

I’d also suggest adding a warning in the UI noting that JSON exports should always be verified against the UI before being used for import or archival purposes, until this is resolved.

Thank you for looking into this — I otherwise really enjoy using Gainium and appreciate the platform.

1 Like

MA indicator is a specific case. After indicator was added, we decided to invert how it displayed. But this is only display change, internal schema unchanged.
When you import your exported settings you will see them identical to the original bot.

thank you for the explanation and workaround. im sure you had your good reasons to invert the json code.

thing is, with the use of a.i. now, im generating json scripts using ai and it gets confused. it would be great if i can get ai to generate a json file that i can just upload. it would save manual entry for each iteration / backtest.

also, im sure i will be confused directing ai later. do you have a mapping chart for inversions you’ve set so maybe if i give it to ai first it will generate the right code for uploads?

As I set its only for disaply. Initially MA was referencing to some value, now some value referencing to MA
Price gt MA is the as MA lt price