Symbol sentiment
The SymbolSentiment interface and SymbolSentimentUpdatedEventArgs class allow you to access real-time market sentiment data via API. For any given symbol:
Symbol.Sentiment.BuyPercentageprovides the aggregate percentage of buy activity, whileSymbol.Sentiment.SellPercentagereturns the aggregate percentage of sell activity.SymbolSentimentUpdatedEventArgsis a data carrier for sentiment update events. This class allows you to access the updated sentiment data for the corresponding symbol.
Warning
Symbol sentiment API objects are supported only in .NET 6 algorithms and do not function in Cloud or cTrader CLI.
Tip
Integrate market sentiment data into automated trading strategies to enhance decision making, increase the likelihood of profitable trades and strengthen risk management.
Symbol sentiment API objects can be used to do the following in algorithms:
| Feature or operation | Examples |
|---|---|
| Sentiment-driven trading | Trade with sentiment bias Trade against extreme sentiment Combine sentiment with candles Exit on sentiment divergence |
| Adaptive risk configuration | Filter out noisy trades Scale trades with sentiment Throttle strategy based on market activity Set stop loss based on sentiment |
| Monitoring and analysis | Create sentiment-based alerts Run sentiment heatmap strategy Spot breakouts through sentiment Validate indicator signals |
Note
As sentiment data is only available in real time, it cannot be used for backtesting or optimisation, since there is no historical or stored data.
Sentiment-driven trading
Trade with sentiment bias
You can program a cBot to confirm trend bias before entering trades or trade only if sentiment matches the direction. For example, the cBot executes a buy if at least 70% of sentiment is bullish, and a sell if 70% is bearish.
1 2 3 4 5 6 7 8 9 10 11 | |
Trade against extreme sentiment
Consider a cBot that enters trades against strong sentiment consensus. The reversal approach in the algorithm assumes the crowd is often wrong at extremes or believes that when a very high proportion of traders are on one side, the market may be ready to turn. For example, if more than 80% of traders are buying, the cBot executes a sell, expecting a reversal. The same logic applies when most are selling.
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
Combine sentiment with candles
You can configure a cBot to act only when both market sentiment and candle direction agree. If it gets a bullish candle and sentiment is above 60% bullish, the cBot buys. If the candle is bearish and the sentiment agrees, the cBot sells. This approach helps you filter out weak signals and avoid false entries.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Exit on sentiment divergence
A cBot can help you exit trades when sentiment no longer supports your position. For example, if you are holding a buy and sentiment flips to over 60% bearish, the cBot closes it. It does the same for sell trades when sentiment turns bullish.
1 2 3 4 5 6 7 8 9 10 | |
Adaptive risk configuration
Filter out noisy trades
You can develop a cBot that avoids trading when there is no clear sentiment bias. For example, if sentiment is nearly split and the difference is under 10%, the cBot skips the trade. This setup filters out noise and protects you from indecisive markets.
1 2 3 4 5 6 7 8 9 10 11 12 | |
Scale trades with sentiment
You can set up a cBot to adjust the position size based on how strongly sentiment leans in one direction. For example, if bullish sentiment outweighs bearish by a large margin, the cBot increases trade volume. If sentiment is close to neutral, the cBot trades smaller.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Throttle strategy based on market activity
Your strategy can be set up to pause trading when sentiment shows signs of a crowded market. For example, if more than 90% of traders are either buying or selling, the cBot stops trading to avoid entering a position just as the market is likely to reverse.
1 2 3 4 5 6 7 8 9 10 | |
Set stop loss according to sentiment
You can instruct a cBot to measure sentiment strength and respond with appropriate stop loss sizing. For example, when bullish sentiment exceeds 80%, the cBot uses a tighter stop of 20 pips. If sentiment is less confident, the cBot sets a wider stop of 50 pips to allow more breathing room.
1 2 3 4 5 6 7 8 | |
Monitoring and analysis
Create sentiment-based alerts
Consider a cBot that monitors sentiment in real time and alerts you when extreme levels are reached. For example, if buy sentiment exceeds 90%, the cBot logs or prints a bullish alert. If sell sentiment crosses the same threshold, it notifies you of extreme bearishness.
1 2 3 4 5 6 7 8 9 10 | |
Run sentiment heatmap strategy
Consider a cBot that runs a sentiment scan across multiple assets and identifies the best trading opportunities. For example, the cBot loops through all available symbols and prints the buy and sell percentages, and then you can focus on those with the most extreme bullish or bearish sentiment.
1 2 3 4 5 6 7 8 | |
Spot breakouts through sentiment
A cBot can be programmed to detect rapid changes in sentiment as a potential sign of a breakout or heightened market volatility. For example, if buy sentiment jumps or drops by more than 15%, the cBot logs the spike as an early indication of a volatile move.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
Validate indicator signals
Rather than relying on indicators alone, you can enhance your strategy by programming your cBot to only act when both indicator and sentiment conditions align. For example, when RSI shows oversold and sentiment is over 70% bullish, the cBot buys. If RSI signals overbought and sentiment exceeds 70% bearish, the cBot sells.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |