Login Page - Create Account

Support Board


Date/Time: Mon, 21 Apr 2025 23:48:02 +0000



Converting From MetaTrader EA (Init, DeInit, OnTick) to Sierra Chart study?

View Count: 561

[2025-02-18 17:57:14]
cmet - Posts: 690
Here's a threaded version from a friend of mine too.
Date Time Of Last Edit: 2025-02-18 17:58:43
attachmentThreadedAutoPolling.cpp - Attached On 2025-02-18 17:58:42 UTC - Size: 2.56 KB - 41 views
[2025-02-18 18:06:26]
LTSys - Posts: 68
here is a more concrete example, that matches your metatrader question

Thanks!

Attached is an example of this. Not very sophisticated but might spawn some ideas if you need them.

Thanks for the help. I'll check them out.

You mentioned earlier you can control how often the study is called in the chart settings... is that under the Performance section in Chart Settings?

I would set these defaults...

sc.AutoLoop = 0;
sc.UpdateAlways = 1;

And then set the "Min Chart Update Interval" or the "Pointer Events interval"?
[2025-02-18 19:02:49]
cmet - Posts: 690
Might be confused by what you mean by "how often the study is called".

This is how I understand it:

Once you add a study to the chart, it's being updated based on the requirements/parameters of the study.

Even though the default is 1 tick, using sc.UpdateAlways=1 forces updates continuously even if no ticks occur.

There is a setting at the chart level for this specifically called "Minimum Chart Update Interval in Milliseconds For ACSIL UpdateAlways".

You can find that in Chart Settings > Performance. You want this to at least be the interval you're using.

sc.UpdateIntervalInMilliseconds is the interval control.

Chart Update Interval in Milliseconds should at least be the interval you're using. This is in Global Settings > General.

sc.AutoLoop = 0 applies to the start/stop functionality.

Both of the examples I posted work as a study applied to the chart (one that is not updating at all) but update at 250 milliseconds continuously.

Probably not the best explanation but that's how I look at it.
Date Time Of Last Edit: 2025-02-18 19:06:35
[2025-02-18 19:07:22]
User907968 - Posts: 840
Working with ACSIL Arrays and Understanding Looping: When the Study Function is Called
[2025-02-18 19:12:48]
LTSys - Posts: 68
Thanks... it's confusing.

There is a setting at the chart level for this specifically called "Minimum Chart Update Interval in Milliseconds For ACSIL UpdateAlways".

Ok I set that really low to 10ms but the fasted the the study function is being called is on average around 400ms.

I must be missing something or perhaps thats just the fastest average time it can do?
[2025-02-18 19:18:16]
cmet - Posts: 690
What is the Chart Update interval?

That has to be set to 250 (or faster) as well.

From documentation above:

When using sc.UpdateAlways = 1. When there is one study on the chart which has this set to true, even a built in Sierra Chart study, this causes the chart to be calculated at every chart update according to the Chart Update Interval. At that time all studies on the chart will be calculated. Although only an update calculation.

[2025-02-18 19:32:44]
LTSys - Posts: 68
I set the "Minimum Chart Update Interval in Milliseconds For ACSIL UpdateAlways" to 100ms... then in the study I use:

int currentMills = sc.CurrentSystemDateTimeMS.GetTimeInMilliseconds();

and minus the last mills from it and the average I get is around 400ms.
Date Time Of Last Edit: 2025-02-18 23:25:48
[2025-02-18 19:54:31]
cmet - Posts: 690
In Global Settings > General Settings > General, what is the entry for "Chart Update Interval in Milliseconds"?
[2025-02-18 20:24:15]
LTSys - Posts: 68
In Global Settings > General Settings > General, what is the entry for "Chart Update Interval in Milliseconds"?

It's 400ms. Can I control it at the chart level instead of globally which I assume is for all charts.
[2025-02-18 20:30:06]
cmet - Posts: 690
Yeah, go to Chart Settings > Display.

Chart Update Interval In Milliseconds (0=Use Global)

That's probably why you're getting the 400ms.
[2025-02-18 21:26:08]
LTSys - Posts: 68
Chart Update Interval In Milliseconds (0=Use Global)

Ok I set that one to 100ms.

I also set the "Minimum Chart Update Interval in Milliseconds For ACSIL UpdateAlways" to 100ms... not sure if that matters?

And now the interval study calls are averaging around 150ms.
[2025-02-18 22:13:04]
cmet - Posts: 690
Yeah, I don't really know the answer to the ACSIL UpdateAlways. Might only kick in if the chart is not updating.

Without custom solutions, Chart Update Interval is driving the bus.

As a side note, anything under 40ms can introduce problems on the resource usage side. At least in my experience.
Date Time Of Last Edit: 2025-02-19 00:04:54
[2025-02-18 23:29:51]
LTSys - Posts: 68
Thanks for all your guys help on this part of the journey.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account