need help to fix error in my coding, only 4 same errors, but seems like there is no solution for it, help me

Created at 11 Nov 2023, 19:25
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
NA

naqidz99

Joined 11.11.2023

need help to fix error in my coding, only 4 same errors, but seems like there is no solution for it, help me
11 Nov 2023, 19:25


this is the part where it has error and i cant manage to fix it

        protected override void OnStart()
        {
            dailyStoch = Indicators.StochasticOscillator(MarketData.GetSymbol("XAUUSD"), TimeFrame.Daily, 7, 14, 5);
            fourHourStoch = Indicators.StochasticOscillator(MarketData.GetSymbol("XAUUSD"), TimeFrame.Hour4, 7, 14, 5);
            oneHourStoch = Indicators.StochasticOscillator(MarketData.GetSymbol("XAUUSD"), TimeFrame.Hour, 7, 14, 5);
            fifteenMinuteStoch = Indicators.StochasticOscillator(MarketData.GetSymbol("XAUUSD"), TimeFrame.Minute15, 7, 7, 5);

it stated that XAUUSD is not in context. 


@naqidz99
Replies

PanagiotisCharalampous
12 Nov 2023, 06:25

Hi there,

You need to pass bars to the indicator constructor, not a symbol. Check GetBars method.

Best regards,

Panagiotis


@PanagiotisCharalampous