Replies

snowchilli
12 Oct 2020, 09:27

RE:

PanagiotisCharalampous said:

Hi snowchilli,

Can you make your question more specific? Which new indicators?

Best Regards,

Panagiotis 

Join us on Telegram

right click in a chart
select "Indicators"
select "Other"
select "TypicalPrice" (or "WeightedPrice")

Having had a closer look these 2 indicators are not new to cTrader 3.8.

Still the same question though

Typical price: (High + Low + Close)/3

Weighted: (Open + High + Low + Close) / 4

Does the indicator 

- "TypicalPrice" use the formula "Typical price: (High + Low + Close)/3"

- WeightedPrice use the formula "Weighted: (Open + High + Low + Close) / 4"
If not, what formulae do those 2 use?


@snowchilli

snowchilli
11 Oct 2020, 11:39

RE:

cAlgo_Fanatic said:

Typical price: (High + Low + Close)/3

Weighted: (Open + High + Low + Close) / 4

Are these the formulae that cTrader 3.8 uses for the new indicators
TypicalPrice and WeightedPrice?


@snowchilli

snowchilli
10 Oct 2020, 03:15

RE: "Bid" price change

trend_meanreversion said:

Hi mate, 

I use tick charts extensively in my research and trading so possibly might be able to answer your questions (which I think you already know answers to).

1) Yes tick charts are based only on "Bid" price change, so only bid price change is considered as tick change. This is intended feature I suppose as possibly incorporating both bid and ask change to be considered as a tick might be computationally expensive and doesn't align with how ctrader/other platforms treat their charts ( even in simple timebased TimeFrames such as 5min, 30mins etc ). OHLC data on charts that you see corresponds to bid price so I am afraid it is just how tick is defined -> any change in bid price is defined as a valid tick.

2) Personally, I would have preferred change in "mid-price" as a valid tick definition but I suppose I can live with current definition as well. You can create own DataSeries within a cBot which only stores "N-tick" information whenever bid price changes or ask price changes and thus can work with your own definition of "Ticks".

Hope it helps.  Happy Trading :)

-TRMR

@TRMR
1) by "Bid" price change, do you mean a bid price has changed due to a position being opened / closed?
    otherwise, it would be sounding as if you are referring to what the "Market Depth" view offers, ie many ask and bid prices staggered by price live with each price point being augmented with aggregate volume (that the liquidity provider of the broker can show),

2) wouldn't you need the positions's volume as well to evaluate the "weight" of a tick?

A 50 lot position could be thought of as more telling where the money is headed than a 0.01 lot position.


@snowchilli

snowchilli
06 Oct 2020, 12:31

RE: RE: RE:

Spotware said:

Antonma said:

Spotware said:

TickVolume shows only Bid changes. It is not possible to retrieve Ask changes.

Ok, thank you for the clarification. What about the volume? How can I get the volume (not tick count) associated to the bid change?

Regards,

Anton

There is no such functionality.

 

6 years later ... How close is Spotware to providing access to the 

  • number of traded lots (or volume)
  • TradeType (opening direction)

for each tick event in cTrader?

(e.g. something like  Bars.Tick.Lots  )

This is essential to judging a bar's weight.


@snowchilli

snowchilli
06 Oct 2020, 11:56

RE: How can Tick.Time be used?

PanagiotisCharalampous said:

You can use  Server.Time.

Looking at the history [of closed positions] the exact time stamp for the opening / closing event (aka Tick) is. e.g.
02/10/2020 08:06:03.003

while Server.Time would have been only exact to the second. e.g.

02/10/2020 08:06:03

How can Tick.Time be used?
According to the cTrader 3.8 documentation Tick Time "Gets the Tick Time."

Tick
Summary
Represents the Tick object.
Syntax
public sealed struct Tick : ValueType, IEquatable
Members
Name	Description
Ask	Gets the Ask price of tick.
Bid	Gets the Bid price of tick.
Time	Gets the Tick time.


 


@snowchilli

snowchilli
24 Jan 2020, 03:38

RE:

PanagiotisCharalampous said:

Hi snowchilli,

You did not add a getter and a setter. See below the correct way to do this

        [Parameter(DefaultValue = enmABC.B)]
        public enmABC ABC { get; set; }

Best Regards,

Panagiotis 

Join us on Telegram

 

Thank you for the correction.

The pre-correction code had built without errors or warnings in cTrader 3.6.
Would have been nice, if cTrader had issued an alert.


@snowchilli

snowchilli
23 Jan 2020, 07:45

RE: RE:

botmaster said:

enum enmABC{ A, B, C};
[Parameter(DefaultValue = enmABC.A)]
public enmABC ABC;

gives this error
Error CS0052: Inconsistent accessibility: field type 'cAlgo.Robots.NewcBot.enmABC' is less accessible than field 'cAlgo.Robots.NewcBot.ABC'

Solution:

public enum enmABC{ A, B, C};
[Parameter(DefaultValue = enmABC.A)]
public enmABC ABC;

However, the above does not show as a parameter for a cBot in cTrader 3.6

What change is needed to make the parameter show as such, when e.g. an instance is added to the bot?
Ideally with a label and group title for the parameter, perhaps as such...

​public enum enmABC{ A, B, C};
[Parameter("Alphabet", Group="Wordcraft", DefaultValue = enmABC.A)]
public enmABC ABC;

 


@snowchilli

snowchilli
21 Jan 2020, 11:10

RE:

Apologies - I had pasted the code into an OnStop function instead of an OnError function.
Thank you for your swift reply.


@snowchilli

snowchilli
13 Nov 2019, 02:55

RE:

Panagiotis Charalampous said:

Hi AlgoDeveloper,

You might find the below example useful

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 CustomTooltip : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        private Tooltip Tooltip;
        private double LastMouseX;
        private double LastMouseY;

        protected override void OnStart()
        {
            Tooltip = new Tooltip 
            {
                VerticalAlignment = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                IsVisible = false,
                Width = 120,
                Height = 40
            };
            Chart.AddControl(Tooltip);

            Chart.ObjectHoverChanged += Chart_ObjectHoverChanged;
            Chart.MouseMove += Chart_MouseMove;
        }

        private void Chart_MouseMove(ChartMouseEventArgs obj)
        {
            LastMouseX = obj.MouseX;
            LastMouseY = obj.MouseY;

            if (Tooltip.IsVisible)
                UpdateTooltipCoorinates();
        }

        private void Chart_ObjectHoverChanged(ChartObjectHoverChangedEventArgs obj)
        {
            if (obj.IsObjectHovered)
                ShowTooltip(obj.ChartObject.Name);
            else
                HideTooltip();
        }

        private void ShowTooltip(string text)
        {
            Tooltip.IsVisible = true;
            Tooltip.Text = text;
            UpdateTooltipCoorinates();
        }

        private void UpdateTooltipCoorinates()
        {

            var extraDelta = 10;
            var width = Tooltip.Width;
            var height = Tooltip.Height;
            var left = Chart.Width - LastMouseX > width + extraDelta ? LastMouseX + extraDelta : LastMouseX - width - extraDelta;
            var right = Chart.Height - LastMouseY > height + extraDelta ? LastMouseY + extraDelta : LastMouseY - height - extraDelta;

            Tooltip.Margin = new Thickness(left, right, 0, 0);
        }

        private void HideTooltip()
        {
            Tooltip.IsVisible = false;
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

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

    public class Tooltip : CustomControl
    {
        public Tooltip()
        {
            var border = new Border 
            {
                BackgroundColor = "#3F3F3F",
                BorderColor = "#969696",
                BorderThickness = 1,
                CornerRadius = 5
            };

            ContentLabel = new TextBlock 
            {
                Margin = 5
            };

            border.Child = ContentLabel;
            AddChild(border);
        }

        private TextBlock ContentLabel { get; set; }

        public string Text
        {
            get { return ContentLabel.Text; }
            set { ContentLabel.Text = value; }
        }


    }
}

Best Regards,

Panagiotis

Building the above code (as is) gives me 3 errors
Error CS0246: The type or namespace name 'CustomControl' could not be found (are you missing a using directive or an assembly reference?)

Error CS0122: 'cAlgo.API.TextBlock' is inaccessible due to its protection level

Error CS0053: Inconsistent accessibility: property type 'cAlgo.API.TextBlock' is less accessible than property 'cAlgo.Robots.Tooltip.ContentLabel'

Am I missing references? What else am I missing?


@snowchilli