Topics
14 Dec 2020, 12:26
 866
 2
02 Apr 2020, 12:44
 1182
 5
20 Mar 2020, 01:49
 1505
 12
15 Feb 2020, 12:29
 930
 6
09 Feb 2020, 11:58
 5
 1132
 1
28 Apr 2019, 10:04
 1456
 7
10 Apr 2019, 14:35
 1025
 4
07 Jan 2019, 15:51
 1268
 6
11 Apr 2018, 19:15
 1531
 2
03 Apr 2018, 14:57
 1967
 10
10 Feb 2018, 08:55
 3575
 13
21 Jan 2018, 07:08
 2103
 9
16 Jan 2018, 08:02
 2053
 5
13 Jan 2018, 11:20
 1852
 3
Replies

dordkash@gmail.com
03 Apr 2020, 12:40

RE:

PanagiotisCharalampous said:

Hi there,

Can you post your complete cBot? Where do you print the values? In OnBar()? You should do it in OnStop().

Best Regards,

Panagiotis 

Join us on Telegram

thank you so much


@dordkash@gmail.com

dordkash@gmail.com
02 Apr 2020, 21:02 ( Updated at: 21 Dec 2023, 09:21 )

RE:

PanagiotisCharalampous said:

Hi there,

You can try the below

 var pips = History.Where(x => x.Label == label).Sum(p => p.Pips);

Best Regards,

Panagiotis 

Join us on Telegram

I wrote this
But that's how it works

I posted a photo


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 11:42

RE:

PanagiotisCharalampous said:

Hi,

The button can be used alone.

Best Regards,

Panagiotis 

Join us on Telegram

Thankyou


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 11:11

RE:

PanagiotisCharalampous said:

Hi,

I explained to you what is the problem with your code. If you don't know how to solve it or you are not familiar with C# programming, you can ask a professional to help you.

Best Regards,

Panagiotis 

Join us on Telegram

Thank you


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 10:39

RE:

PanagiotisCharalampous said:

Hi,

IsChecked is not an event handler but a property. It takes a boolean value. This is why you get the error. 

What are you trying to do?

Best Regards,

Panagiotis 

Join us on Telegram

I explained above

This command puts a few buttons on the chart, I want these keys to appear on the chart when checked, and not to show when canceled

Thankyou


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 10:35

RE:

PanagiotisCharalampous said:

Hi,

If you mean the chart UI controls, then this is not possible. WinForms have their own controls. You can drag them on the form editor from Visual Studio toolbox.

Best Regards,

Panagiotis 

Join us on Telegram

Could you tell me what command I should transfer to VS?
So that I can get on the button on form
I was looking for an example of how to do this


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 10:17

RE:

PanagiotisCharalampous said:

Hi there,

Can you provide the complete source code and explain what is the problem?

Best Regards,

Panagiotis 

Join us on Telegram

In fact, I would like to know if there are several Button on the chart, do I need to use a Stakepanel or a Wrappanel or ... or can the Button be used alone?


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 10:09 ( Updated at: 21 Dec 2023, 09:21 )

RE: RE: RE:

PanagiotisCharalampous said:

dordkash@gmail.com said:

 

var checkBox = new CheckBox()
{
    Text = "Show Volume",
    IsChecked = Chart.DisplaySettings.TickVolume,
    VerticalAlignment = VerticalAlignment.Top,
    HorizontalAlignment = HorizontalAlignment.Left,
    Margin = 5
};
checkBox.Click += e => Chart.DisplaySettings.TickVolume = e.CheckBox.IsChecked.Value;
Chart.AddControl(checkBox);

Hi
what is the problem?

            var checkBox = new CheckBox 
            {

                Text = "Show SYMBOLS",
                IsChecked = Chart.AddControl(STMU),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = "70 0"
            };
            checkBox.Click += e => Chart.AddControl(STMU) = e.CheckBox.IsChecked.Value;
            Chart.AddControl(checkBox);

Error CS0029: Cannot implicitly convert type 'void' to 'bool?'

Error CS0131: The left-hand side of an assignment must be a variable, property or indexer

Error CS0029: Cannot implicitly convert type 'bool' to 'void'

Hi,

Your problem is here

 IsChecked = Chart.AddControl(STMU)

What are you trying to do?

Best Regards,

Panagiotis 

Join us on Telegram

 

I want this command(

  Chart.AddControl(STMU)

) to run when the checkbox is selected and to cancel when it is unchecked

This command puts a few buttons on the chart, I want these keys to appear on the chart when checked, and not to show when canceled


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 10:05 ( Updated at: 21 Dec 2023, 09:21 )

RE: RE: RE:

PanagiotisCharalampous said:

dordkash@gmail.com said:

ClickAlgo said:

I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.

HI

TextBoxes dont work

Please correct it
It can be very useful
Thankful

Hi,

Can you explain what do you mean?

Best Regards,

Panagiotis 

Join us on Telegram

 

Yes

When this code goes into VS and the form is added to it, it gets a few errors when Build


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 10:01 ( Updated at: 21 Dec 2023, 09:21 )

RE: RE: RE:

PanagiotisCharalampous said:

dordkash@gmail.com said:

PanagiotisCharalampous said:

Hi xavier.affringue,

See an example below

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

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        private Form1 _f1;
        private Thread _thread;

        protected override void Initialize()
        {
            _f1 = new Form1();
            _thread = new Thread(() => _f1.ShowDialog());
            _thread.SetApartmentState(ApartmentState.STA);
            _thread.Start();

        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
        }
    }
}


Best Regards,

Panagiotis

Dear PanagiotisCharalampous

Please paste this code with a button or Stakepanel
I'm confused and this is very helpful
Thankful

Hi,

Where do you want to add the button or stackpanel?

Best Regards,

Panagiotis 

Join us on Telegram

 

In this code

I would like to put a Button or a Stakepanel in the window that is made in this code
The same form window that is created by VS


@dordkash@gmail.com

dordkash@gmail.com
23 Mar 2020, 06:37 ( Updated at: 21 Dec 2023, 09:21 )

RE:

PanagiotisCharalampous said:

Hi xavier.affringue,

See an example below

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

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }

        private Form1 _f1;
        private Thread _thread;

        protected override void Initialize()
        {
            _f1 = new Form1();
            _thread = new Thread(() => _f1.ShowDialog());
            _thread.SetApartmentState(ApartmentState.STA);
            _thread.Start();

        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
        }
    }
}


Best Regards,

Panagiotis

Dear PanagiotisCharalampous

Please paste this code with a button or Stakepanel
I'm confused and this is very helpful
Thankful


@dordkash@gmail.com

dordkash@gmail.com
22 Mar 2020, 22:05 ( Updated at: 21 Dec 2023, 09:21 )

RE:

ClickAlgo said:

I forgot to mention, you do not need to write the GUI (presentation) code, just create your form with the controls and open the Form.Designer.cs file and copy and paste into your Indicator, you can can then create nice and clean complex forms in a very short time.

HI

TextBoxes dont work

Please correct it
It can be very useful
Thankful


@dordkash@gmail.com

dordkash@gmail.com
22 Mar 2020, 09:51 ( Updated at: 21 Dec 2023, 09:21 )

RE:

 

var checkBox = new CheckBox()
{
    Text = "Show Volume",
    IsChecked = Chart.DisplaySettings.TickVolume,
    VerticalAlignment = VerticalAlignment.Top,
    HorizontalAlignment = HorizontalAlignment.Left,
    Margin = 5
};
checkBox.Click += e => Chart.DisplaySettings.TickVolume = e.CheckBox.IsChecked.Value;
Chart.AddControl(checkBox);

Hi
what is the problem?

            var checkBox = new CheckBox 
            {

                Text = "Show SYMBOLS",
                IsChecked = Chart.AddControl(STMU),
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Margin = "70 0"
            };
            checkBox.Click += e => Chart.AddControl(STMU) = e.CheckBox.IsChecked.Value;
            Chart.AddControl(checkBox);

Error CS0029: Cannot implicitly convert type 'void' to 'bool?'

Error CS0131: The left-hand side of an assignment must be a variable, property or indexer

Error CS0029: Cannot implicitly convert type 'bool' to 'void'


@dordkash@gmail.com

dordkash@gmail.com
20 Mar 2020, 18:30

RE:

PanagiotisCharalampous said:

Hi there,

Here it is. If you have specific questions, let me know.

Best Regards,

Panagiotis 

Join us on Telegram

Where's the problem with this code is that all the keys are overlapping?

 

                foreach (var TFFF in TFF)
                {
.
.
.
.
.
.
.
.
.
.
.
.

                    var BTF3 = new Button 
                    {
                        Text = TFFF.ToString(),
                        FontSize = 11,
                        ForegroundColor = Color.Blue,
                        FontWeight = FontWeight.UltraBold,
                        Margin = 10,
                        IsVisible = true,
                        BackgroundColor = Color.Empty,
                        HorizontalAlignment = HorizontalAlignment.Right,
                        VerticalAlignment = VerticalAlignment.Top




                    };


                    BTF3.Click += E => Chart.TryChangeTimeFrameAndSymbol(TFFF, SymbolName);
                    Chart.AddControl(BTF3);
                }

 


@dordkash@gmail.com

dordkash@gmail.com
20 Mar 2020, 13:56

RE:

PanagiotisCharalampous said:

Hi there,

Here it is. If you have specific questions, let me know.

Best Regards,

Panagiotis 

Join us on Telegram

Oh my God
It was very helpful, great
I've been looking for this information for a long time
thank you so much


@dordkash@gmail.com

dordkash@gmail.com
20 Mar 2020, 11:26

RE:

PanagiotisCharalampous said:

Hi there,

There are some samples here, you can have a look.

Best Regards,

Panagiotis 

Join us on Telegram

Where do you mean?
Do you have a link?

I've seen some of the code but it's not comprehensive


@dordkash@gmail.com

dordkash@gmail.com
18 Mar 2020, 19:32

RE:

PanagiotisCharalampous said:

Hi there,

I am not sure what do you mean. The example I provided also takes a string variable as input string. 

Best Regards,

Panagiotis 

Join us on Telegram

Yes
But its output is a specified frame time
I want my output to be exactly the TimeFrame , not that TimeFram.Daily OR Hour4 OR ...


@dordkash@gmail.com

dordkash@gmail.com
18 Mar 2020, 12:10

RE:

PanagiotisCharalampous said:

Hi there,

You can write a function to convert a a string to a timeframe. Check this thread.

Best Regards,

Panagiotis 

Join us on Telegram

 

 

Yes I saw this
But there must be a specified time frame in this code
For example H4,DAYLI ....

But here my frame time is variable


@dordkash@gmail.com

dordkash@gmail.com
17 Mar 2020, 21:41 ( Updated at: 21 Dec 2023, 09:21 )

RE:
        [Parameter("TIME FRAME 2")]
        public TimeFrame TF2 { get; set; }

        [Parameter("TIME FRAME 3")]
        public TimeFrame TF3 { get; set; }

        [Parameter("TIME FRAME 4")]
        public TimeFrame TF4 { get; set; }


        protected override void Initialize()
        {
            // Initialize and create nested indicators

            TimeFrame[] TFF = 
            {
                TF2,
                TF3,
                TF4
            };

            var STF2 = new StackPanel 
            {
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Right

            };

            foreach (var TFFF in TFF)
            {
                var PDH1 = MarketData.GetBars(TFFF, SymbolName);
                //....
                //....
                //....
                var BTF2 = new Button 
                {
                    Text = SymbolName + TFFF.ToString(),
                    Margin = "TFFF",
                    FontSize = 11,
                    FontWeight = FontWeight.UltraBold,
                    FontFamily = SymbolName

                };
                BTF2.Click += BTF2CLK;
                STF2.AddChild(BTF2);
            }

        }

        private void BTF2CLK(ButtonClickEventArgs obj)
        {
            var symbolName = obj.Button.FontFamily;
            var BC = obj.Button.Margin;

            Chart.TryChangeTimeFrameAndSymbol(BC, symbolName);
        }

dordkash@gmail.com said:

Hi

I wrote this code
To be more detailed, I just copied what I had a problem with
It gives the BC

an error as to why the string is there and not the time frame
What solution do you offer
 

 


@dordkash@gmail.com

dordkash@gmail.com
19 Feb 2020, 13:38

RE:

PanagiotisCharalampous said:

Hi reza h,

Here is a general example on how to raise/lower a flag based on conditions

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
    {

        bool _hammerDetected;
        protected override void OnStart()
        {
            // Put your initialization logic here
        }

        protected override void OnBar()
        {
            if (LowerFlag())
            {
                _hammerDetected = false;
            }

            if (!_hammerDetected && HammerDetected())
            {
                _hammerDetected = true;
            }
        }

        private bool LowerFlag()
        {
            // put here the conditions to lower your flag
            return true;
        }

        private bool HammerDetected()
        {
            // detect your hammer
            return true;
        }

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

 

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you
I'm trying to figure out how to make it


@dordkash@gmail.com