Skip to content

SymbolSentimentUpdatedEventArgs.Sentiment

property · SymbolSentimentUpdatedEventArgs · cAlgo.API Since 5.3

DesktopCLICloud

Gets sentiment.

Environment behaviour

Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (SymbolSentiment.Updated).

Definition

public SymbolSentiment Sentiment {get;}
symbolSentimentUpdatedEventArgs.Sentiment: SymbolSentiment

Returns SymbolSentiment

Examples

protected override void OnStart()
{
    if (Symbol.Sentiment != null)
        Symbol.Sentiment.Updated += OnSentimentUpdated;
}

private void OnSentimentUpdated(SymbolSentimentUpdatedEventArgs args)
{
    if (args.Sentiment.BuyPercentage > 70)
        Print("Most traders are buying: {0}%", args.Sentiment.BuyPercentage);
}
def on_start(self):
    if api.Symbol.Sentiment is not None:
        api.Symbol.Sentiment.Updated += self.on_sentiment_updated

def on_sentiment_updated(self, args):
    if args.Sentiment.BuyPercentage > 70:
        api.Print(f"Most traders are buying: {args.Sentiment.BuyPercentage}%")