Reference custom indicator

PsykotropyK since: 17 Sep 2012;

  20 Sep 2012, 09:08
Reference custom indicator

Ok indeed something was wrong with my robot code :) Creating a robot miss the line "using cAlgo.Indicators;" Now its fixed and working

matttt since: 21 Sep 2012;

  21 Sep 2012, 11:21

To PsykotropyK or the support team,

 

Can you clarify your solution given in your last post ?

I do have the same issue with calling an indicator which works on the plateforme (the indicator is Aroon Horn and was downloaded from this forum).

It still gives the same error message when building the code : "The type or namespace name 'AroonHorn' could not be found are you using directive or an assembly reference?)"

I checked the spelling, it was correct. I even tried renaming the indicator (new file to keep the old one OK) without space and it still return the same error message when building the bot.

 

Beginning of the code is copied hereunder if someone could help (yet this part which is the one causing troubles) :

 


//#reference: C:\Documents and Settings\Mat\Mes documents\cAlgo\Sources\Indicators\AroonHorn.algo
// -------------------------------------------------------------------------------------------------
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo.Robots
{
    [Robot]
    public class ISSUEALONE : Robot 
    { 
        [Parameter ("Period", DefaultValue = 10)]
        public int Period { get; set; }
        
        [Parameter("Filter", DefaultValue = 25)]
        public int Filter { get; set; }

        [Parameter("Stop Loss (pips)", DefaultValue = 10)]
        public int StopLoss { get; set; }

        [Parameter("Volume", DefaultValue = 10000, MinValue = 0)]
        public int Volume { get; set; }

        private Position position;        
        private AroonHorn ARH;

        protected override void OnStart()
        {
            ARH = Indicators.GetIndicator<AroonHorn>(Period, Filter);
        }

        protected override void OnBar()
        {
            if (Trade.IsExecuting) return;

 

 

and then follow the rest of the code with decision parameters... etc...

Thanks in advance for your help.

PsykotropyK since: 17 Sep 2012;

  22 Sep 2012, 11:33

My solution was only to add

using cAlgo.Indicators;

I'm not sure it will help, but change your reference to your indicator by

//#reference: ..\Indicators\AroonHorn.algo

It will prevent any errors if you change your directories, computer name, ...

Fr the rest, in your AroonHorn indicator, is the class declared at the begining is named AroonHorn (I don't know much C# but it should be this name that you call)

public class AroonHorn : Indicator

Then check that your parameters declaration is in the same order in your indicator and in your robot. If not, copy past the exact error

PsykotropyK since: 17 Sep 2012;

  22 Sep 2012, 16:01

An other thing, is your reference at the first line of your code? I just try a new robot an put it after the first comment : didn't work. Put it back first line, work perfectly

matttt since: 21 Sep 2012;

  24 Sep 2012, 16:11
Reference custom indicator

Hi PsykotropyK,

Thanks for the tips and the reply...

It appears that the issue was, as you suggested, that the class declared at the beginning in the indicator was "NewIndicator" instead of AroonHorn called in the robot. First thing solved !!

I also made the following changes which seem to be good advice : ''change your reference to your indicator by //#reference: ..\Indicators\AroonHorn.algo''...

Another mistake is appearing now but I'll of course check if I can solve it myself first before asking for help.

Thanks again PsykotropyK,