Skip to main content
All CollectionsCody AI - Trading Assistant
Tips for writing a Cody prompt
Tips for writing a Cody prompt

Find the best ways to write a prompt to get the best results when using Cody AI to code your trading strategies.

Quad Team avatar
Written by Quad Team
Updated over a year ago

Summary

In this article, we will cover in detail how to write a prompt for Cody and how to optimize it to get the best results.

Details

How to write a prompt

There are a few main elements to include when writing a strategy with Cody:

  • The amount

    • By default, the strategy will use the entire allocated capital.

    • If you want to specify a different amount you can use either a number or a percentage of the allocated capital

  • The trigger / condition

    • Basically, when to buy and sell.

    • You can define it using TA, real-time data, price, etc.

  • Logical conditions (optional)

    • You can build advanced automation using logic connectors like: when, if, or, and, if not, or else, then, etc.

  • The pair (optional)

    • By default your bot will use the pair selected in the settings.

    • Note that, if you specify multiple pairs, the backtest functionality will fail.

    • However, the bot will be able to run multiple pair trading strategies live. If you want to test multiple pairs, consider running multiple backtests with each pair separately.

Tips to improve your prompts

Use clear and concise language.

It's important to use clear and concise language when creating prompts for Cody. This will help ensure that the code generated accurately reflects the intended trading strategy. The prompts should clearly specify when to buy and sell assets, and any relevant conditions or thresholds that trigger these actions. Using simple and straightforward language will make it easier for Cody to generate accurate code.

Do example ✅

Buy $100 of Bitcoin every Monday at 10am Eastern Time, and sell all if the price increases by 10% or more. Repeat this process for 4 weeks.

Don't example

Purchase Bitcoin on a weekly basis at different times based on the market analysis and sell them once they appreciate a good percentage value. Stop trading if the gains are not achieved.

In the example above, "a good percentage value" is not clear enough and will result in approximations.

Define clearly your orders

To ensure that the code generated by Cody accurately reflects the intended trading strategy, it's important to clearly define your orders. These include:

  • the amount of assets to buy or sell

    • note that you can use a % of your available cash as well as a defined amount

  • the frequency of trades

    • the frequency should always match the one in the settings

  • The type of order

    • You can use: market, limit, stop, OCO

By defining these variables clearly, Cody can generate code that accurately reflects the intended trading strategy.

Do example ✅

Buy $100 of Bitcoin every Monday at 10am Eastern Time until $1,000 has been spent. If the price of Bitcoin increases by 10% or more, sell all Bitcoin. Use a stop-loss of 5% to limit losses.

Don't example ❌

Buy Bitcoin every week until the market value reaches $65,000. If the market value goes up by a good amount, sell all Bitcoin. Use a stop-loss feature to minimize losses.

In this example, the amount is not clearly defined,

Specify your triggers accurately

Once again, to generate an accurate code, make sure to clearly specify your triggers accurately. This includes

  • Defining clearly the timeframe to use

  • The exact list of indicators you want to use

  • Any thresholds that trigger buy or sell actions.

Do example ✅

Buy $50 of Doge when RSI is <30 on the daily chart. Repeat every day until $500 has been spent. Use a take-profit of 10% to lock in gains. If RSI>30 on the daily chart then do not buy.

Don't example ❌

Buy Doge whenever it's cheap and sell it when it's expensive. Don't spend too much money on Doge. This is the most effective way to make money.

You might be interested in:

Did this answer your question?