Topics
23 Jun 2021, 20:06
 0
 932
 1
03 Jun 2020, 09:37
 0
 1015
 1
02 Aug 2019, 09:45
 0
 1324
 1
21 Jan 2019, 22:23
 1178
 1
21 Jan 2019, 22:06
 1593
 2
01 Oct 2018, 10:55
 1
 915
 1
05 Apr 2018, 20:42
 2039
 5
15 Mar 2018, 16:14
 1985
 1
Replies

Bits
04 Mar 2020, 11:11

RE:

PanagiotisCharalampous said:

Hi yearn2012,

Unfortunately I cannot reproduce your issues since I am missing FxCore.Common.Setting and I do not see anywhere xs.Select((i)=>i.name=="kk"). Can you tell us what errors are you getting?

Best Regards,

Panagiotis 

Join us on Telegram

 

Now I send to you a full simple code:

using cAlgo.API;
using System.Linq;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class kk : Indicator
    {
        private string jia;

        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }
        public string s { get; set; } = "5";
        public string Jia { get => jia; set => jia = value; }

        protected override void Initialize()
        {
            this.Watchlists.Single((i) => i.Name == "list");
        }

        public override void Calculate(int index)
        {
            // Logic code
        }
    }
}

this code complide error!


@Bits

Bits
19 Apr 2019, 07:00

RE:

yearn2012 said:

In Multiply TimeFrame , DataMarket.GetSeries Function only get defualt data,How to get series starting form custom time?

I want to get more data than default number,how to solve?? thanks!!


@Bits

Bits
20 Apr 2018, 04:27

RE: RE:

yearn2012 said:

I have find find it is my wrong,now want to know while indicator[index] has draw the value,  how to redraw it if needed.

 

 


@Bits

Bits
19 Apr 2018, 21:22 ( Updated at: 21 Dec 2023, 09:20 )

RE:

    Who can Explain the calgo's build error??? Use below code, Whether​ it should not be  draw a indicator line And drawtext "NAN" in the high of every Bar or draw a indicator line in the price 107.39 and drawText 107.39 in the high of every Bar,  but the result is Disappointing​...
the drawText(result) is107.39, but the indicatot not draw a indicator line

    Is it my fault?​????

The Result property show two diffirent  value??????

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CS : Indicator
    {
        [Output("main", Color = Colors.Yellow)]
        public IndicatorDataSeries Result { get; set; }
        protected override void Initialize()
        {
        }
        public override void Calculate(int index)
        {
            if (index == 0)
            {
                Result[0] = 107.39;
            }
            Result[index] = 107.39;
            Result[index - 1] = double.NaN;

            ChartObjects.DrawText(index.ToString(), Result[index].ToString(), index, MarketSeries.High[index] + 0.01);

        }
    }
}

 


@Bits

Bits
19 Apr 2018, 21:20 ( Updated at: 21 Dec 2023, 09:20 )

RE:

yearn2012 said:

Who can Explain the calgo's build error??? Use below code, Whether​ it should not be  draw a indicator line And drawtext "NAN" in the high of every Bar or draw a indicator line in the price 107.39 and drawText 107.39 in the high of every Bar,  but the result is Disappointing​...
​the drawText(result) is107.39, but the indicatot not draw a indicator line
Is it my fault?​????
 




namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CS : Indicator
    {
        [Output("main", Color = Colors.Yellow)]
        public IndicatorDataSeries Result { get; set; }
        protected override void Initialize()
        {
        }
        public override void Calculate(int index)
        {
            if (index == 0)
            {
                Result[0] = 107.39;
            }
            Result[index] = 107.39;
            Result[index - 1] = double.NaN;

            ChartObjects.DrawText(index.ToString(), Result[index].ToString(), index, MarketSeries.High[index] + 0.01);

        }
    }
}

The Result property show two diffirent  value??????


@Bits

Bits
18 Apr 2018, 04:56 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Panagiotis Charalampous said:

Hi yearn2012,

You can send your code at community@spotware.com. Please also try to put a description of what your indicator is supposed to do, what would you expect to see and what you are seeing instead. This will help us help you.

Best Regards,

Panagiotis

Panagiotis ​:

I have saved the source code file to the Email  community@spotware.com.

 [Output("分型", Color = Colors.Yellow)]
        public IndicatorDataSeries Result { get; set; }

 public override void Calculate(int index)
        {
            C.Calculates(index);
            ChartObjects.DrawText(index.ToString(), Result[index].ToString(), index, C.BarInfos[index].High);

        }

 


@Bits

Bits
17 Apr 2018, 19:26

RE:

Panagiotis Charalampous said:

Hi tinker.this,

You can find an example of how to draw a line here. Boxes are currently not available but maybe you can use a combination of horizontal and vertical lines.

Best Regards,

Panagiotis

I think that the api should offer the expand ability of chartObject class,so can solve more things.eg:draw special shape or and control.


@Bits

Bits
17 Apr 2018, 10:49 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Panagiotis Charalampous said:

Hi yearn2012,

As I mentioned above, I need the complete indicator source code in order to help you.

Best Regards,

Panagiotis

the main wrong execute code:

 

/// LastBarInfo.Index<index  is true !

 if ((MarketSeries.High[index] - MarketSeries.Low[index]) >= (LastBarInfo.High - LastBarInfo.Low))
           {
          BarTemp = new BarInfo { High = double.NaN, Low = double.NaN, Trend = BarTrend.Con, Index = LastBarInfo.Index };
           BarInfos.Remove(LastBarInfo);
           BarInfos.Insert(LastBarInfo.Index, BarTemp);
          BarInfos[LastContainIndex] = new BarInfo { High = 0, Low = 0, Trend = BarTrend.Con, Index = LastBarInfo.Index };

}

My email is 157683719@qq.com,you can send your Email  Address  to me ,so i can send my  soures code.

 

And I find the same simple code execute  wrong!

using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
//using Me.Indicator;
using System.Collections.Generic;
using Me.Indicator;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class CS : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("分型", Color = Colors.Yellow)]
        public IndicatorDataSeries Result { get; set; }

        public List<BarInfo> BarInfos { get; set; }
        protected override void Initialize()
        {
            BarInfos = new List<BarInfo>();
        }

        public override void Calculate(int index)
        {
            BarInfos.Add(new BarInfo 
            {
                High = MarketSeries.High[index],
                Low = MarketSeries.Low[index],
                Index = index,
                Trend = BarTrend.Up
            });

            if (index % 5 == 0)
            {
                BarInfos.RemoveAt(index);
                BarInfos.Insert(index, new BarInfo 
                {
                    High = MarketSeries.High[index],
                    Low = MarketSeries.Low[index],
                    Index = -index,
                    Trend = BarTrend.Con
                });
            }

            BarInfo k = BarInfos[index];


/////////

            if ((BarTrend)k.Trend == BarTrend.Con)
            {
                ChartObjects.DrawText(index.ToString(), k.Index.ToString(), index, MarketSeries.High[index], VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Blue);
            }
/////////

            ChartObjects.DrawText(index.ToString(), k.Index.ToString(), index, MarketSeries.High[index] + 0.3, VerticalAlignment.Center, HorizontalAlignment.Center, Colors.Azure);

            Result[index] = BarInfos[index].High;


            Print(index.ToString() + " L:" + BarInfos[index].Trend.ToString());

        }
    }

    public enum BarTrend
    {
        Up = 1,
        Down = -1,
        Con = 0
    }
    public class BarInfo
    {
        public double High;
        public double Low;
        public int Index;
        public BarTrend Trend;
    }
}

The code between the "//////" cannot execute rightly, the   "  if((BarTrend)k.Trend == BarTrend.Con) { ...} "cannot running in,

the screenshots show below:


@Bits

Bits
17 Apr 2018, 07:05 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Panagiotis Charalampous said:

Hi yearn2012,

We cannot see how you calculate Result_Pt. Therefore we cannot advise. If you wish, please post the complete code so that we can reproduce and provide an explanation.

Best Regards,

Panagiotis

 

Panagiotis,GOOD MOONING

​IN this pictrue, i watch in vs debugger, the indicator value of  Results[1506] is NAN,the value of  BarInfos[1056].trend is null,and this bar is the time of 2018-4-16 12:10. this is the Screenshots​ while the index is 1600,so i am sure than  the value of 1056th will be not calculated  in after time.

 public class BarInfo
    {
        public double High;
        public double Low;
        public int Index;
        public BarTrend Trend;
    }

List<BarInfo> BarInfos;

in below pictrue,in the chart,  Results[1506] is NAN value,is right, but the  value of   BarInfos[1056]     is UP not null value of watch list   in the time of 2018-4-16 12:10.

​the c# code  is blowe:

 string s = "";

            s = C.BarInfos[index].Trend.ToString();


            ChartObjects.DrawText(index.ToString(), s, index, Result[index] + 0.005, VerticalAlignment.Center, HorizontalAlignment.Center, Colors.White);

what wrong ,i donot find it, it 


@Bits

Bits
15 Apr 2018, 19:30

RE:

Panagiotis Charalampous said:

Hi yearn2012,

You can use a condition in the Calculate function and skip the calculation for bars before a certain time. See below

        private DateTime _openTime;
        protected override void Initialize()
        {
            // Initialize and create nested indicators
        }

        public override void Calculate(int index)
        {
            if (MarketSeries.OpenTime[index] > _openTime)
            {
                // Calculate Indicator;
            }
        }

Let me know if this helps,

Best Regards,

Panagiotis

it's right ,thanks!

 


@Bits

Bits
15 Apr 2018, 19:28

RE:

Panagiotis Charalampous said:

Hi yearn2012,

You need to change the object name each time. See below an example

ChartObjects.DrawLine(index.ToString(), index - 1, 0, index - 1, 131, Colors.Red, 2, LineStyle.Solid);

Best Regards,

Panagiotis

Thanks,Panagiotis !


@Bits

Bits
12 Apr 2018, 04:18 ( Updated at: 21 Dec 2023, 09:20 )

RE: RE:

yearn2012 said:

Panagiotis Charalampous said:

Hi yearn2012,

See below

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            var form = new Form();
            form.Show();
        }

        protected override void OnTick()
        {

        }

        protected override void OnStop()
        {

        }
    }
}

Best Regards,

Panagiotis

Thanks ,it is great!!

But 

I add a form success,but the form is waiting state always.

[Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
.
.
.
1:waiting state
 protected override void Initialize()
        {
            BarInfos = new List<BarInfo>();
            var form = new Form 
            {
                Height = 200,
                Width = 300
            };
            var but = new Button 
            {
                Text = "ss"
            };
            form.Controls.Add(but);
            form.Show();
        }

2:waiting state
 protected override void Initialize()
        {
            BarInfos = new List<BarInfo>();
            var form = new Form 
            {
                Height = 200,
                Width = 300
            };
              form.Show();
        }

 


@Bits

Bits
12 Apr 2018, 03:37

RE:

Panagiotis Charalampous said:

Hi yearn2012,

We will need the code for the indicator to be able to help you. Unfortunately the error messages are in Chinese therefore we cannot understand what the problem might be.

Best Regards,

Panagiotis

I have solved it,most possibly is the calgo builder is not support the native method it is in the lastest C# 7.1,


@Bits

Bits
12 Apr 2018, 03:31

RE:

Panagiotis Charalampous said:

Hi yearn2012,

See below

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

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC)]
    public class NewcBot : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        protected override void OnStart()
        {
            var form = new Form();
            form.Show();
        }

        protected override void OnTick()
        {

        }

        protected override void OnStop()
        {

        }
    }
}

Best Regards,

Panagiotis

Thanks ,it is great!!


@Bits

Bits
10 Apr 2018, 05:03

RE:

Panagiotis Charalampous said:

Hi yearn2012,

Your questions are very broad and cannot be answered in a single post.

1. how to add awidget,eg:A button or messageBox

You need to be more specific to this. In general, it is possble to launch external forms using a cBot.

 2.how to get the infos of current chart and all opened cha

What info of the chart do you need? Bars, spot prices, time?

 If i want to access it,is it have api support,which API is it

It is not clear what you want to access? The chart? Do you need to add information on the chart? Please be more specific.

Best Regards,

Panagiotis 

Can you provide an example of launch external forms using a cBot?


@Bits

Bits
09 Apr 2018, 05:26

RE:

Panagiotis Charalampous said:

Hi yearn2012,

The reason you cannot debug a custom indicator is because you probably installed cTrader 3.0 on a computer that already has cAlgo 2.01 installed. In this case, your existing cBots are not replaced, however they need a necessary addition in order to be debuggable in Visual Studio. In order to resolve this problem, please follow the next steps

  1. Go to Properties > AssemblyInfo.cs
  2. Add the following code at the bottom of the file
#if DEBUG
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations)]
#endif

This should fix your problem. Repeat this solution for every indicator/cBot you need to debug in Visual Studio. Newly generated cBots/Indicators should contain this attribute by default.

Best Regards,

Panagiotis

 

Thank you  Panagiotis ​, the issume is Solved!


@Bits

Bits
06 Apr 2018, 03:28 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Sorry  Panagiotis Charalampous ,I must reply here about the calgo'wrong.

​it look like the indicator file don't excecute the  else  function. the debugger sometimes is find the ""hidebysig​" attribute in function.

 

  public class Lk : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        public List<BarInfo> BarInfos;
        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        protected override void Initialize()
        {
            BarInfos = new List<BarInfo>();
            // Initialize and create nested indicators
        }
        public override void Calculate(int index)
        {
            CulBarInfo(index, MarketSeries, BarInfos);
            Print(BarInfos.Count);
        }

        public  void CulBarInfo(int index, MarketSeries marketSeries, List<BarInfo> barInfos)
        {
            BarInfo bar = barInfos.FindLast(x => x.Trend != BarTrend.Null);
            if (bar.Index == 0)
            {
                bar = barInfos.Last();
            }
            #region MyRegion
            if (marketSeries.High[index] > bar.High && marketSeries.Low[index] > bar.Low)
            {
///......
            }
            #endregion

        }


    }

while the functions "Calculate" execute function "CulBarInfo",the error has happend. what wrong??


@Bits

Bits
05 Apr 2018, 01:26

RE:
yearn2012 said:
1. how to add awidget,eg:A button or messageBox. 2.how to get the infos of current chart and all opened chart? If i want to access it,is it have api support,which API is it? Thank you.


@Bits

Bits
05 Apr 2018, 01:26

RE:
yearn2012 said:
1. how to add awidget,eg:A button or messageBox. 2.how to get the infos of current chart and all opened chart? If i want to access it,is it have api support,which API is it? Thank you.


@Bits

Bits
30 Mar 2018, 03:39 ( Updated at: 21 Dec 2023, 09:20 )

RE:Can i access the Renko Charts by the calgo api?

Spotware said:

Soon Renko charts will be introduced in cTrader. A Renko chart is a type of chart that is only concerned with price movement; time and volume are not included.

CCan

renko.png

 


@Bits