Topics
Replies
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
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
MaVe
15 Dec 2015, 22:18
Printing the time of the crossover on the chart
MarketSeries.OpenTime.LastValue did it:
@MaVe