Topics
30 Sep 2017, 10:45
 2635
 5
24 Sep 2017, 09:35
 2326
 6
28 Jul 2017, 13:39
 1792
 2
24 Nov 2016, 15:46
 2055
 1
04 Aug 2016, 17:40
 2052
 3
24 Jul 2016, 14:01
 2690
 4
28 May 2016, 09:26
 2424
 4
13 Apr 2016, 16:36
 2935
 1
10 Feb 2016, 19:32
 4121
 5
03 Feb 2016, 12:39
 2118
 2
02 Feb 2016, 19:39
 3722
 7
02 Feb 2016, 08:52
 2501
 4
Replies

MaVe
15 Dec 2015, 22:18

Printing the time of the crossover on the chart

MarketSeries.OpenTime.LastValue did it:

if (MA50.Result.HasCrossedAbove(MA200.Result, 0))
            {
                ChartObjects.DrawText("UP", "EMA(50) ▲ EMA(200) : " + MarketSeries.OpenTime.LastValue, StaticPosition.TopLeft, Colors.Blue);
            }

 


@MaVe

MaVe
15 Dec 2015, 09:59

Printing the time of the crossover on the chart

Maybe Santa can help me out here?


@MaVe

MaVe
15 Dec 2015, 09:53

Dear Spotware,

Thank you for your attention on this issue.

I've posted this suggestion there to vote for.

Thank you

 


@MaVe

MaVe
14 Dec 2015, 10:37

Dear Spotware,

I've followed your recommendation. Could you further assist on how to print the exact crossover time?

if (MA50.Result.HasCrossedAbove(MA200.Result, 0))
            {
                ChartObjects.DrawText("UP", "MA50 UP MA200 : " + Time.ToString(), StaticPosition.TopLeft, Colors.Blue);
            }

Thank you.


@MaVe

MaVe
17 Sep 2015, 12:06

Dear Spotware,

If I use the HasCrossedAbove Function and the ChartObjects.DrawVerticalLine Internal,
together with VerticalAlignment and TextOffset, then it is not possible to have the dot/bullet/arrow
directly om the crossing-lines of the two EMA's each time.
(Compared to the VerticalLine)

Is that correct?

Is there something to combine this with the values of the two EMA's.
That is to say when the value of EMA1=EMA2.
(The position of the white circles that I've put manually on the chart above)


@MaVe

MaVe
17 Sep 2015, 09:29 ( Updated at: 21 Dec 2023, 09:20 )

RE:

Dear Spotware,

I understand the functions mentioned above,

Specific: a dot on the EMA crossing lines, as seen on the chart below.

Is that possible?


@MaVe

MaVe
15 Sep 2015, 09:03

Dear Spotware,

Thank you for the objective response.

MaVe

(Under certain circumstances, for visual testing reasons, decimals on an EMA would be usefull)


@MaVe

MaVe
14 Sep 2015, 21:13

RE:

Spotware said:

Dear Trader,

We are not sure we understand what you are trying to do.

You cannot change the values calculated in the EMA indicator. However you could add them to an IndicatorDataSeries and add/subtract/roundup the values you like.

The following code snippet illustrates it:

        private ExponentialMovingAverage ema;
        protected override void Initialize()
        {
            ema = Indicators.ExponentialMovingAverage(MarketSeries.Close, 50);
        }
        public override void Calculate(int index)
        {
            // Display the ema result on the chart
            Result[index] = ema.Result[index] + 1;
        }

We hope this helps you.

Dear Spotware,

I meant the EMA Period as a number with digits after the decimal point.

Example beneath with EMA(20) indicator, how to adapt to EMA(20.123)?

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

namespace cAlgo
{
    [Indicator(IsOverlay = true, AutoRescale = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class MaVe2015 : Indicator
    {
        [Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MaType { get; set; }
// -----              
        [Output("EMA(20)", Color = Colors.White)]
        public IndicatorDataSeries MA20Result { get; set; }
// -----        
        MovingAverage MA20;
// ------------------------------------------------------         
        protected override void Initialize()
        {
            MA20 = Indicators.MovingAverage(MarketSeries.Close, 20, MaType);
        }
// ------------------------------------------------------ 
        public override void Calculate(int index)
        {
            MA20Result[index] = MA20.Result[index];
        }
    }
}

 


@MaVe