Replies

igorjrmedeiros
18 Jul 2019, 17:24

RE:

alex_mihail said:

Thanks Panagiotis!

EDIT: Is there a way to specify this to grab the highest point WITHIN 5 bars back rather than the high FROM 5 bars back exactly?

Hi alex_mihail,

 

Look this, I hope help you.

 

double max = Functions.Maximum(MarketSeries.High, period);

// where: period is the bars back
//            

 


@igorjrmedeiros

igorjrmedeiros
18 Jul 2019, 17:13

RE: RE:

stuart said:

stuart said:

I am trying to get Chart.DrawText()  to draw text under each candle. 

but i only get text on the most recent candle  [index]

in Calculate() i have

Chart.DrawText("UPDOWN", i.ToString(), i, MarketSeries.Low[i] - 5, "#8fb300");

 

how do i get it to work on each candle?

 

 

I tried the Obsolete ChartObjects.DrawText  and it works as expected.

so why does the new Chart.DrawText not work the same way?

i feel like we are in the dark with these updates.

 

 

Hi stuart,

Try to do it:

 

Chart.DrawText("UPDOWN" + i, i.ToString(), i, MarketSeries.Low[i] - 5, "#8FB300");

The first parameter is the name to your instance. Try it.

I am considering that your index is the "int i".

 

Best Regards,


@igorjrmedeiros

igorjrmedeiros
18 Jul 2019, 17:05

RE:

Panagiotis Charalampous said:

Hi igorjrmedeiros,

Just drag the remaining time label to the left.

Best Regards,

Panagiotis

Thanks again,

 

Best Regards,


@igorjrmedeiros

igorjrmedeiros
18 Jul 2019, 17:04

RE:

Panagiotis Charalampous said:

Hi igorjrmedeiros,

ChartObjects is obsolete. Use Chart.

Best Regards,

Panagiotis

 

Thanks a lot. 

 

Best Regards,


@igorjrmedeiros

igorjrmedeiros
12 Jul 2019, 13:20

RE:

alex_mihail said:

Hi guys - do you know if its possible to write an indicator that draws a line X amount of time set by the user?

Hi Alex,

In the indicator class I have been trying to use the Timer (from Algo.API) but without sucess.

So, I used the System.Timers class and it work...

Try this:

Put the namespace as the example bellow: (NOTE: put it in this order... because if you reference the System.Timers afterthe cAlgo.API a ambiguos error is showed.)

 

using System;
using System.Timers; // This is the Timer class from System namespace
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

After this you need create the Class for it...

Declare this class inside your Public Class Indicator

private static System.Timers.Timer aTimer;

So now... you need to initialize the timer and set the interval.

In the Initialize function do it:

        protected override void Initialize()
        {
            aTimer = new System.Timers.Timer(1000);  // 1000 is the time in milliseconds
            aTimer.Elapsed += OnTimedEvent;      // ---------->> Attention here!!
            aTimer.AutoReset = true;
            aTimer.Enabled = true;
        }

look into the code a line aTimer.Elapsed += OnTimedEvent. This is the function that will be called when the Timer elapsed happen.

So you need to created this function.... so try it:

 

private void OnTimedEvent(Object source, ElapsedEventArgs e)
        {
            // Put here your code that will be executed in timer elapsed.
            Print("something");

        }

So... I hope this helps

:)


@igorjrmedeiros

igorjrmedeiros
11 Jul 2019, 10:42

Hi Panagiotis,

 

How can I do it? I am trying to  move it left but doesn't works.

 

Thanks a lot.


@igorjrmedeiros