Replies

hengsarathvichet
11 Jun 2018, 14:45

RE:

Panagiotis Charalampous said:

Hi hengsarathvichet,

The indicator will run for the same symbol as the cBot. Do you need something different? Do you need an indicator for another symbol than the cBot's one?

Best Regards,

Panagiotis

I'm running it externally on Windows Form. Yes I need to use a custome indicator.

This : /algos/indicators/show/425


@hengsarathvichet

hengsarathvichet
11 Jun 2018, 13:01

RE:

Panagiotis Charalampous said:

Hi hengsarathvichet,

Which currency pair are you talking about? The one that the cBot will trade on?

Best Regards,

Panagiotis

I got null error from this

Robot m = new Robot();
            Symbol eurUsd = m.MarketData.GetSymbol("EURUSD");
            MarketSeries seriesEurUsd = m.MarketData.GetSeries(eurUsd, TimeFrame.Minute);
            Console.WriteLine(seriesEurUsd.SymbolCode);

@hengsarathvichet

hengsarathvichet
11 Jun 2018, 12:17

RE:

Panagiotis Charalampous said:

Hi hengsarathvichet,

Which currency pair are you talking about? The one that the cBot will trade on?

Best Regards,

Panagiotis

Ok, I know how to do that but What about custom Indicator ? 


@hengsarathvichet

hengsarathvichet
11 Jun 2018, 11:57

RE:

Panagiotis Charalampous said:

Hi hengsarathvichet,

Here it is

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        private RelativeStrengthIndex _rsi;
        protected override void OnStart()
        {
            var series = MarketData.GetSeries(TimeFrame.Daily);
            _rsi = Indicators.RelativeStrengthIndex(series.Close, 14);
        }

        protected override void OnBar()
        {
            Print(_rsi.Result.LastValue);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Best Regards,

Panagiotis

If so, Where can I set currency pair ?


@hengsarathvichet

hengsarathvichet
11 Jun 2018, 11:38

How about i want to use a custom indicator ?


@hengsarathvichet

hengsarathvichet
11 Jun 2018, 11:13

RE:

Panagiotis Charalampous said:

Hi hengsarathvichet,

See below an example of calling an indicator from within a cBot

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class NewcBot : Robot
    {
        private RelativeStrengthIndex _rsi;
        protected override void OnStart()
        {
            _rsi = Indicators.RelativeStrengthIndex(MarketSeries.Close, 14);
        }

        protected override void OnBar()
        {
            Print(_rsi.Result.LastValue);
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

Let me know if this is what you are looking for.

Best Regards,

Panagiotis

Yes it is. Anymore example of robot and how can I set by timeframe ?


@hengsarathvichet