How do you draw the time of a crossover on the chart?

Created at 12 Dec 2015, 23:40
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
MaVe's avatar

MaVe

Joined 24.08.2015

How do you draw the time of a crossover on the chart?
12 Dec 2015, 23:40


When using the HasCrossedAbove Function together with the ChartObjects.DrawText Internal,
is it possible to draw the time of a crossover on the chart? When yes: how?


@MaVe
Replies

Spotware
14 Dec 2015, 01:51

Dear Trader,

We recommend you to have a look at the example HasCrossedAbove section in our API reference. Adjusting the example and inserting the DrawText() in the if statement, could help you to successfully print the time on the chart. 

Please note that we don't provide coding assistance services. We more than glad to assist you with specific questions about cAlgo.API. You can contact one of our Partners or post a job in Development Jobs section for further coding assistance.

 


@Spotware

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
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, 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