Replies

lucrum
12 Jun 2020, 16:47

RE:

PanagiotisCharalampous said:

Hi lucrum,

Your indicator has only one parameter but you are initializing it with two. 

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you. A touch of Fridayitis.

Nick


@lucrum

lucrum
22 Nov 2019, 16:56

RE:

Spotware said:

Hi Nick,

This happens because you are using the wrong index for the market series. Line 45 should change to the following

   gbpusdDiff[index] = ((gbpStart - gbpusd.Open[gbpusd.OpenTime.GetIndexByExactTime(MarketSeries.OpenTime[index])]) / (gbpStart)) * 100;

Best Regards,

Panagiotis

Dear Panagiotis

Thank you. Is there any cTrader documentation that fully explains how [index] works?

Nick


@lucrum

lucrum
22 Nov 2019, 16:26

RE:

Panagiotis Charalampous said:

Hi Nick,

The symbol is hardcoded

var gbpusd = MarketData.GetSeries("GBPUSD", Frame);

Do you change that before running on GBPJPY?

Best Regards,

Panagiotis

Dear Panagiotis

No. Irrespective of the daily chart on display I want to see only the GBPUSD calculation. In other words whilst on a GBPJPY chart I want to see the GBPUSD indicator in the window underneath.

Nick 


@lucrum

lucrum
22 Nov 2019, 15:01

RE:

Panagiotis Charalampous said:

Hi Nick,

Can you please explain to us what is the problem? What did you expect to happen and what happens instead?

Best Regards,

Panagiotis

When this code is run on a Daily GBPUSD chart the indicator at the most recent bar shows the net movement (%) from 2 January 2019, based on a start level of 100. This is correct. When I run this on a GBPJPY chart for instance, I get a different, and incorrect, outcome.

Nick


@lucrum

lucrum
08 Aug 2019, 20:44

Thank you for the explanation. I am getting a similar problem with accessing the value of horizontal lines from an indicator. At this stage all I want to do is print the value in the bot.

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

namespace cAlgo
{

    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ActiveAreas : Indicator
    {
        public Color _textColor;

        [Parameter("High Color", DefaultValue = "DarkOrange")]
        public string ColorH { get; set; }

        [Parameter("Low Color", DefaultValue = "Orange")]
        public string ColorL { get; set; }

        [Parameter("Low Lookback", DefaultValue = "0")]
        public int LowLookback { get; set; }

        [Parameter("High Lookback", DefaultValue = "2")]
        public int HighLookback { get; set; }

        protected override void Initialize()
        {
        }

        public override void Calculate(int index)
        {
            var series = MarketData.GetSeries(TimeFrame.Daily);
            var highPrice = series.High.Last(HighLookback);
            var lowPrice = series.Low.Last(LowLookback);

            Chart.DrawHorizontalLine("Active Area High", highPrice, ColorH, 2, LineStyle.Solid);
            Chart.DrawHorizontalLine("Active Area Low", lowPrice, ColorL, 2, LineStyle.Solid);
            Print("High trade = {0}", highPrice);

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




namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.WEuropeStandardTime, AccessRights = AccessRights.None)]
    public class CallingLinesIndic : Robot
    {

        public string currency = "EURUSD";
        //Create an object (same as an instance) of the Class HighToHighMA (the indicator). In this example the object name is 'linesIndicator'.
        private ActiveAreas linesIndicator;

        protected override void OnStart()
        {
            //This defines what the object does.
            linesIndicator = Indicators.GetIndicator<ActiveAreas>();
        }

        protected override void OnTick()
        {

        }

        protected override void OnBar()
        {
            Print("Weekly high is {0}", linesIndicator.highPrice);
        }


    }
}

 

 


@lucrum

lucrum
06 Aug 2019, 16:47

 

Thank's Panagiotis. What is the logic behind repeating 'highToHigh'?

 

Nick


@lucrum