NexusTrade guide

Apple (AAPL) Martingale Strategy

Always hold a little Apple, and continuously double down on Apple (AAPL) until you make a profit

Rule summary

  1. Buy $250 of AAPL whenever the portfolio holds no AAPL.

    Buy $250 AAPL Position market value (AAPL) = Constant 0

  2. Buy 100% of the current AAPL position whenever the portfolio holds AAPL and days since the last filled buy order of AAPL is above 28.

    Buy AAPL Position market value (AAPL) > Constant 0 and # of Days Since the Last Filled Buy Order of AAPL > Constant 28

  3. Sell 100% of the current AAPL position whenever the portfolio holds AAPL and the gain or loss on the AAPL position (%) is at or above 10.

    Sell AAPL Position market value (AAPL) > Constant 0 and Position P&L % (AAPL) ≥ Constant 10

What this recipe does

Always hold a little Apple, and continuously double down on Apple (AAPL) until you make a profit

Exact strategy rules

These are the library's actual rule definitions. Conditions, assets, position sizing and order actions are shown together so the strategy can be inspected before it is copied.

json
[
  {
    "_id": "6aca33eeb0137be4feaadd02",
    "name": "Buy $250 of AAPL whenever the portfolio holds no AAPL.",
    "userId": null,
    "active": true,
    "condition": {
      "lhs": {
        "compound": false,
        "targetAssets": [
          {
            "name": "AAPL",
            "type": "Stock",
            "symbol": "AAPL"
          }
        ],
        "form": {
          "fields": [
            {
              "fields": [
                {
                  "helperText": "Ticker name (ex. SPY, BTC)",
                  "name": "targetAssets.name",
                  "label": "Asset Name",
                  "required": true,
                  "fieldType": "text",
                  "value": "AAPL"
                },
                {
                  "helperText": "Ticker type (ex. Stock, Crypto)",
                  "name": "targetAssets.type",
                  "label": "Asset Type",
                  "required": true,
                  "fieldType": "select",
                  "values": [
                    "Stock",
                    "Cryptocurrency"
                  ],
                  "value": "Stock"
                }
              ],
              "multiple": true,
              "deletable": false
            }
          ]
        },
        "type": "PositionValue",
        "name": "Position market value (AAPL)"
      },
      "rhs": {
        "compound": false,
        "targetAssets": [],
        "value": 0,
        "form": {
          "fields": [
            {
              "fields": [
                {
                  "helperText": "Constant value",
                  "name": "value",
                  "label": "Value",
                  "required": true,
                  "fieldType": "number",
                  "value": 0,
                  "min": -100,
                  "max": 100,
                  "globalMin": -1000000,
                  "globalMax": 1000000,
                  "isInteger": false
                }
              ],
              "multiple": false,
              "deletable": false
            }
          ]
        },
        "type": "Value",
        "name": "Constant 0"
      },
      "name": "Position market value (AAPL) = Constant 0",
      "_id": "6aca33ee279f0a69a03e37dd",
      "comparison": "equal",
      "type": "Base",
      "description": "Left-Hand indicator (comparator) Right-Hand Indicator",
      "example": "If the Rate of Change of Apple's price is > the Value 0."
    },
    "createdAt": "2026-10-10T12:47:42.701Z",
    "action": {
      "type": "Buy",
      "targetAsset": {
        "name": "AAPL",
        "type": "Stock",
        "symbol": "AAPL"
      },
      "amount": {
        "type": "dollars",
        "amount": 250
      }
    },
    "orderExecution": {
      "type": "Market"
    },
    "automaticOrderApproval": false
  },
  {
    "_id": "6aca33eeb0137be4feaadd04",
    "name": "Buy 100% of the current AAPL position whenever the portfolio holds AAPL and days since the last filled buy order of AAPL is above 28.",
    "userId": null,
    "active": true,
    "condition": {
      "name": "Position market value (AAPL) > Constant 0 and # of Days Since the Last Filled Buy Order of AAPL > Constant 28",
      "_id": "6aca33ee5d23b01d88395190",
      "type": "And",
      "description": "All conditions must be true",
      "example": "If Apple's price is up today but down for the week.",
      "conditions": [
        {
          "lhs": {
            "compound": false,
            "targetAssets": [
              {
                "name": "AAPL",
                "type": "Stock",
                "symbol": "AAPL"
              }
            ],
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Ticker name (ex. SPY, BTC)",
                      "name": "targetAssets.name",
                      "label": "Asset Name",
                      "required": true,
                      "fieldType": "text",
                      "value": "AAPL"
                    },
                    {
                      "helperText": "Ticker type (ex. Stock, Crypto)",
                      "name": "targetAssets.type",
                      "label": "Asset Type",
                      "required": true,
                      "fieldType": "select",
                      "values": [
                        "Stock",
                        "Cryptocurrency"
                      ],
                      "value": "Stock"
                    }
                  ],
                  "multiple": true,
                  "deletable": false
                }
              ]
            },
            "type": "PositionValue",
            "name": "Position market value (AAPL)"
          },
          "rhs": {
            "compound": false,
            "targetAssets": [],
            "value": 0,
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Constant value",
                      "name": "value",
                      "label": "Value",
                      "required": true,
                      "fieldType": "number",
                      "value": 0,
                      "min": -100,
                      "max": 100,
                      "globalMin": -1000000,
                      "globalMax": 1000000,
                      "isInteger": false
                    }
                  ],
                  "multiple": false,
                  "deletable": false
                }
              ]
            },
            "type": "Value",
            "name": "Constant 0"
          },
          "name": "Position market value (AAPL) > Constant 0",
          "_id": "6aca33ee3bcdde786c75ed2a",
          "comparison": "greaterThan",
          "type": "Base",
          "description": "Left-Hand indicator (comparator) Right-Hand Indicator",
          "example": "If the Rate of Change of Apple's price is > the Value 0."
        },
        {
          "lhs": {
            "compound": false,
            "targetAssets": [
              {
                "name": "AAPL",
                "type": "Stock",
                "symbol": "AAPL"
              }
            ],
            "side": "Buy",
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Matches order events with this side (buy or sell)",
                      "name": "side",
                      "label": "Order side",
                      "required": true,
                      "fieldType": "select",
                      "values": [
                        "Buy",
                        "Sell"
                      ],
                      "value": "Buy"
                    }
                  ],
                  "multiple": false,
                  "deletable": false
                },
                {
                  "fields": [
                    {
                      "helperText": "Matches order events with this status",
                      "name": "orderStatus",
                      "label": "Order Status",
                      "required": true,
                      "fieldType": "select",
                      "values": [
                        "Pending",
                        "Accepted",
                        "Pending User Approval",
                        "Canceled",
                        "Filled",
                        "Partially Filled"
                      ],
                      "value": "Filled"
                    }
                  ],
                  "multiple": false,
                  "deletable": false
                },
                {
                  "fields": [
                    {
                      "helperText": "Ticker name (ex. SPY, BTC)",
                      "name": "targetAssets.name",
                      "label": "Asset Name",
                      "required": false,
                      "fieldType": "text",
                      "value": "AAPL"
                    },
                    {
                      "helperText": "Ticker type (ex. Stock, Crypto)",
                      "name": "targetAssets.type",
                      "label": "Asset Type",
                      "required": false,
                      "fieldType": "select",
                      "values": [
                        "Stock",
                        "Cryptocurrency"
                      ],
                      "value": "Stock"
                    }
                  ],
                  "multiple": true,
                  "deletable": false
                }
              ]
            },
            "type": "DaysSinceOrder",
            "orderStatus": "Filled",
            "name": "# of Days Since the Last Filled Buy Order of AAPL"
          },
          "rhs": {
            "compound": false,
            "targetAssets": [],
            "value": 28,
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Constant value",
                      "name": "value",
                      "label": "Value",
                      "required": true,
                      "fieldType": "number",
                      "value": 28,
                      "min": -100,
                      "max": 100,
                      "globalMin": -1000000,
                      "globalMax": 1000000,
                      "isInteger": false
                    }
                  ],
                  "multiple": false,
                  "deletable": false
                }
              ]
            },
            "type": "Value",
            "name": "Constant 28"
          },
          "name": "# of Days Since the Last Filled Buy Order of AAPL > Constant 28",
          "_id": "6aca33eea03aa3ac52eaa5f1",
          "comparison": "greaterThan",
          "type": "Base",
          "description": "Left-Hand indicator (comparator) Right-Hand Indicator",
          "example": "If the Rate of Change of Apple's price is > the Value 0."
        }
      ]
    },
    "createdAt": "2026-10-10T12:47:42.702Z",
    "action": {
      "type": "Buy",
      "targetAsset": {
        "name": "AAPL",
        "type": "Stock",
        "symbol": "AAPL"
      },
      "amount": {
        "type": "percent of current positions",
        "amount": 100
      }
    },
    "orderExecution": {
      "type": "Market"
    },
    "automaticOrderApproval": false
  },
  {
    "_id": "6aca33eeb0137be4feaadd06",
    "name": "Sell 100% of the current AAPL position whenever the portfolio holds AAPL and the gain or loss on the AAPL position (%) is at or above 10.",
    "userId": null,
    "active": true,
    "condition": {
      "name": "Position market value (AAPL) > Constant 0 and Position P&L % (AAPL) ≥ Constant 10",
      "_id": "6aca33eec5620451fa675ad9",
      "type": "And",
      "description": "All conditions must be true",
      "example": "If Apple's price is up today but down for the week.",
      "conditions": [
        {
          "lhs": {
            "compound": false,
            "targetAssets": [
              {
                "name": "AAPL",
                "type": "Stock",
                "symbol": "AAPL"
              }
            ],
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Ticker name (ex. SPY, BTC)",
                      "name": "targetAssets.name",
                      "label": "Asset Name",
                      "required": true,
                      "fieldType": "text",
                      "value": "AAPL"
                    },
                    {
                      "helperText": "Ticker type (ex. Stock, Crypto)",
                      "name": "targetAssets.type",
                      "label": "Asset Type",
                      "required": true,
                      "fieldType": "select",
                      "values": [
                        "Stock",
                        "Cryptocurrency"
                      ],
                      "value": "Stock"
                    }
                  ],
                  "multiple": true,
                  "deletable": false
                }
              ]
            },
            "type": "PositionValue",
            "name": "Position market value (AAPL)"
          },
          "rhs": {
            "compound": false,
            "targetAssets": [],
            "value": 0,
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Constant value",
                      "name": "value",
                      "label": "Value",
                      "required": true,
                      "fieldType": "number",
                      "value": 0,
                      "min": -100,
                      "max": 100,
                      "globalMin": -1000000,
                      "globalMax": 1000000,
                      "isInteger": false
                    }
                  ],
                  "multiple": false,
                  "deletable": false
                }
              ]
            },
            "type": "Value",
            "name": "Constant 0"
          },
          "name": "Position market value (AAPL) > Constant 0",
          "_id": "6aca33ee9a9eb6d706053fb7",
          "comparison": "greaterThan",
          "type": "Base",
          "description": "Left-Hand indicator (comparator) Right-Hand Indicator",
          "example": "If the Rate of Change of Apple's price is > the Value 0."
        },
        {
          "lhs": {
            "compound": false,
            "targetAssets": [
              {
                "name": "AAPL",
                "type": "Stock",
                "symbol": "AAPL"
              }
            ],
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Ticker name (ex. SPY, BTC)",
                      "name": "targetAssets.name",
                      "label": "Asset Name",
                      "required": true,
                      "fieldType": "text",
                      "value": "AAPL"
                    },
                    {
                      "helperText": "Ticker type (ex. Stock, Crypto)",
                      "name": "targetAssets.type",
                      "label": "Asset Type",
                      "required": true,
                      "fieldType": "select",
                      "values": [
                        "Stock",
                        "Cryptocurrency"
                      ],
                      "value": "Stock"
                    }
                  ],
                  "multiple": true,
                  "deletable": false
                }
              ]
            },
            "type": "PositionPercentChange",
            "name": "Position P&L % (AAPL)"
          },
          "rhs": {
            "compound": false,
            "targetAssets": [],
            "value": 10,
            "form": {
              "fields": [
                {
                  "fields": [
                    {
                      "helperText": "Constant value",
                      "name": "value",
                      "label": "Value",
                      "required": true,
                      "fieldType": "number",
                      "value": 10,
                      "min": -100,
                      "max": 100,
                      "globalMin": -1000000,
                      "globalMax": 1000000,
                      "isInteger": false
                    }
                  ],
                  "multiple": false,
                  "deletable": false
                }
              ]
            },
            "type": "Value",
            "name": "Constant 10"
          },
          "name": "Position P&L % (AAPL) ≥ Constant 10",
          "_id": "6aca33ee1173dbc16eef4b79",
          "comparison": "greaterThanOrEqual",
          "type": "Base",
          "description": "Left-Hand indicator (comparator) Right-Hand Indicator",
          "example": "If the Rate of Change of Apple's price is > the Value 0."
        }
      ]
    },
    "createdAt": "2026-10-10T12:47:42.702Z",
    "action": {
      "type": "Sell",
      "targetAsset": {
        "name": "AAPL",
        "type": "Stock",
        "symbol": "AAPL"
      },
      "amount": {
        "type": "percent of current positions",
        "amount": 100
      }
    },
    "orderExecution": {
      "type": "Market"
    },
    "automaticOrderApproval": false
  }
]

Before testing

Open the library, find this recipe by its title and preview the rules. Choose Use template for a built-in entry, or Add to portfolio for a saved entry. Review the copied rules and customize their thresholds and allocations before testing. Choose a historical period and starting capital in the portfolio backtester. Check trade count, drawdown, costs and a benchmark before enabling a paper portfolio. A recipe is a configuration, not a performance result.

A completed test should show the selected period, orders and portfolio statistics. If it records no trades, inspect the entry conditions and selected assets before loosening rules. If market data is missing or the run fails, keep the error and fix the coverage issue before comparing results. Changing a threshold or allocation changes the strategy. Keep the original definition and compare changes on a separate period rather than selecting settings from one favorable result.