How to insert two indicators using two timeframes

Created at 23 Jul 2020, 15:56
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!
AC

ac15x

Joined 22.07.2020

How to insert two indicators using two timeframes
23 Jul 2020, 15:56


Hi,

 

I want two moving averages. I trigger chart and 1 higher timeframe. Example:

 

 protected override void OnStart()
        {
            _sma1HR = Indicators.SimpleMovingAverage(SourceSma, 8); //For 1 Hour timeframe
            _sma4HR = Indicators.SimpleMovingAverage(SourceSma, 8); //For 4 Hour timeframe

        }

 

Thanks


@ac15x
Replies

PanagiotisCharalampous
23 Jul 2020, 16:11

Hi ac15x,

You can use GetBars() to get data from other timeframes and use them as sources for your indicators.

Best Regards,

Panagiotis 

Join us on Telegram

 


@PanagiotisCharalampous

ac15x
23 Jul 2020, 16:49

RE:

PanagiotisCharalampous said:

Hi ac15x,

You can use GetBars() to get data from other timeframes and use them as sources for your indicators.

Best Regards,

Panagiotis 

Join us on Telegram

 

thankyou


@ac15x