How can I defer the calculation of indicator?

Questions about MultiCharts and user contributed studies.
2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

How can I defer the calculation of indicator?

Postby 2haerim » 09 Jan 2008

When I plot an indicator, I would like to use only today's data only but no yesterday's data at all. Please don't ask me why. I just need it that way.

The indicator needs at least 1 bars to start to plot.

When the market opens, there are no bars built since I limited the date range for today only. The problem is whenever I open my workspace, the applied indicator's status gets turned off because there is no bars built yet.

So I had to turn the status on everytime I open the workspace before market opens. I hate doing this.

Is there any way to defer the calculation of indicator till enough # of bars built so that the status does not get turned off?

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Postby ABC » 09 Jan 2008

2haerim,

if I understand you there are a couple of ways around it. The easiest would probably be to load two days on the chart, but limit the calculations to the current date only. This way your study shouldn't be turned off when you open the workspace and you are still only calculating your study on current days data.

Best regards,
ABC

2haerim
Posts: 502
Joined: 01 Sep 2006
Been thanked: 2 times

Will this work?

Postby 2haerim » 10 Jan 2008

After loading 2 days back data,

If Date = CurrentDate Then Begin
...bla bla
End;

will this make the indicator's status not turned off and at the same time the indicator won't depend on Yesterday's data at all?

User avatar
ABC
Posts: 718
Joined: 16 Dec 2006
Location: www.abctradinggroup.com
Has thanked: 125 times
Been thanked: 408 times
Contact:

Postby ABC » 10 Jan 2008

2haerim,

from what I understand the status is turned off, because you don't have enough bars on the chart. To overcome this problem, you load the additional day (depending on the study it might need even more days).

If Date = CurrentDate Then Begin
Will start the calculations once this is true. If you are using reserved words like HighY for example, it might use yesterday's data. You'll have to check this for yourself.

Another approach would be to reset everything at the date change:
If Date <> Date[1] then begin
reset all your values here
and begin with new calculations.

Best regards,
ABC


Return to “MultiCharts”