Getappinfo(High, Low, Time): When is this values reavaluate

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1263
Joined: 23 Nov 2010
Has thanked: 717 times
Been thanked: 221 times

Getappinfo(High, Low, Time): When is this values reavaluate

Postby arjfca » 15 Jul 2012

Hello

Technical question here on the function: Getappinfo(aihighestDispValue);. This one will return the highest price value shown on the chart. If we change the bar spacing, a new value will be return in respect of the highest price that is displayed on the chart at that moment.

Now, my question is: when is this value is reevaluated. When I'm scrolling backward on my chart, the value is not changed and is kept to the original one. Maybe is is reevaluated after a new tick, but I'm testing out when the market is off.

The goal here is to reduce my memory usage by plotting or putting text only to the visible region of my charts. Actually, MC do seems to calculate indicator on all bars of the series. Doing so, it reserve and use memory space that is not visible or in usage. If you have an historical data composed of 10 000 bars, and you look at only 500 then memory is waste on the 9 500 bars.

I got indicator that display if a bar do open on a gap. When it occur, I display a "V" or "^" above under the bar. I got another indicator that is showing with a vertical line the beginning of a week or a particular session ( Asia, Europe, North America)

All of these info are use for immediate showing. Logically, I may not need to have them calculated for the whole series. If I scroll back, MC could recalculate the data and show me what I want at that moment. All would be unseen to the users and memory usage could be greatly reduce in my case.

Naturally, my assertion is hypothetical since I don't know how MC work internally and can only speculate. What I do know, is, I got a reel slowing down problem with my PC when my indicators are in use.

Martin

User avatar
JoshM
Posts: 2075
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1523 times
Been thanked: 1480 times
Contact:

Re: Getappinfo(High, Low, Time): When is this values reavalu

Postby JoshM » 17 Jul 2012

arjfca wrote:Now, my question is: when is this value is reevaluated. When I'm scrolling backward on my chart, the value is not changed and is kept to the original one. Maybe is is reevaluated after a new tick, but I'm testing out when the market is off.

The GetAppInfo reserved words are reevaluated when the indicator or signal is recalculated. On realtime data this can be done on every tick (with Update on every tick on), on bar close (with that option off or using BarStatus(1) = 2).

With historical data (i.e. no incoming ticks) you can use RecalcLastBarAfter() to force a periodically recalculation after a certain amount of seconds, or use the new mouse events to force a recalculation (with the Recalculate reserved word) when you click on the chart.
These users thanked the author JoshM for the post:
arjfca

arjfca
Posts: 1263
Joined: 23 Nov 2010
Has thanked: 717 times
Been thanked: 221 times

Re: Getappinfo(High, Low, Time): When is this values reavalu

Postby arjfca » 17 Jul 2012

JoshM wrote:The GetAppInfo reserved words are reevaluated when the indicator or signal is recalculated. On realtime data this can be done on every tick (with Update on every tick on), on bar close (with that option off or using BarStatus(1) = 2).

With historical data (i.e. no incoming ticks) you can use RecalcLastBarAfter() to force a periodically recalculation after a certain amount of seconds, or use the new mouse events to force a recalculation (with the Recalculate reserved word) when you click on the chart.


Hello Josh

The GetAppInfo is not recalculated in my case on every tick, In fact it is recalculated or is values updated a should say, when I turn off and on again the indicator. The update on every tick is selected.

To test, I did use my actual code to display time vertical line. These lines High and low are calculated to go from the Lowest and Highest part of the chart. As the day progress, the High and low are not readjusted. If I modify my chart definition using the "Increase, decrease bar spacing, the values of the GetAppInfo are not updated

As I'm writing, a new time line bar as been draw and the high of the bar as been stopped to the high of the initial charts when the indicator was put on.

I will see to add the recalculate event with the mouse event

Martin :)

User avatar
JoshM
Posts: 2075
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1523 times
Been thanked: 1480 times
Contact:

Re: Getappinfo(High, Low, Time): When is this values reavalu

Postby JoshM » 17 Jul 2012

arjfca wrote:The GetAppInfo is not recalculated in my case on every tick, In fact it is recalculated or is values updated a should say, when I turn off and on again the indicator. The update on every tick is selected.


I'm not sure if I follow you; since here the indicator that updates on every tick shows the changing the GetAppInfo values if the bar spacing changes (note in the output below that the CurrentBar remains the same, but the BarSpacing is changed -- and so does the output from GetAppInfo on every tick):

Code: Select all

17-07_10:01:10  CurrentBar: 838, BarSpacing: 7, aiHighestDispValue: 127.99, aiLowestDispValue: 127.80, aiLeftDispDateTime: 15:01:31, aiRightDispDateTime: 10:01:13
17-07_10:01:11  CurrentBar: 838, BarSpacing: 7, aiHighestDispValue: 127.99, aiLowestDispValue: 127.80, aiLeftDispDateTime: 15:01:31, aiRightDispDateTime: 10:01:15
17-07_10:01:37  CurrentBar: 838, BarSpacing: 18, aiHighestDispValue: 127.96, aiLowestDispValue: 127.80, aiLeftDispDateTime: 21:00:44, aiRightDispDateTime: 10:01:38
17-07_10:01:37  CurrentBar: 838, BarSpacing: 18, aiHighestDispValue: 127.96, aiLowestDispValue: 127.80, aiLeftDispDateTime: 21:00:44, aiRightDispDateTime: 10:01:38
17-07_10:01:37  CurrentBar: 838, BarSpacing: 18, aiHighestDispValue: 127.96, aiLowestDispValue: 127.80, aiLeftDispDateTime: 21:00:44, aiRightDispDateTime: 10:01:38
17-07_10:01:37  CurrentBar: 838, BarSpacing: 18, aiHighestDispValue: 127.96, aiLowestDispValue: 127.80, aiLeftDispDateTime: 21:00:44, aiRightDispDateTime: 10:01:38
17-07_10:01:37  CurrentBar: 838, BarSpacing: 18, aiHighestDispValue: 127.96, aiLowestDispValue: 127.80, aiLeftDispDateTime: 21:00:44, aiRightDispDateTime: 10:01:38
17-07_10:01:37  CurrentBar: 838, BarSpacing: 18, aiHighestDispValue: 127.96, aiLowestDispValue: 127.80, aiLeftDispDateTime: 21:00:44, aiRightDispDateTime: 10:01:38
17-07_10:01:59  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:16
17-07_10:02:07  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:24
17-07_10:02:07  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:24
17-07_10:02:07  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:24
17-07_10:02:07  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:24
17-07_10:02:07  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:24
17-07_10:02:07  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:24
17-07_10:02:09  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:26
17-07_10:02:09  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:26
17-07_10:02:09  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:26
17-07_10:02:09  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:26
17-07_10:02:09  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:26
17-07_10:02:09  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:26
17-07_10:02:10  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:27
17-07_10:02:11  CurrentBar: 838, BarSpacing: 1, aiHighestDispValue: 128.00, aiLowestDispValue: 127.57, aiLeftDispDateTime: 08:02:00, aiRightDispDateTime: 10:02:28


With this indicator (set to update on every tick, with skip identical ticks off):

Code: Select all

once cleardebug;

Variables:
   numDeci(DecimalsOfInstrument);

if (LastBarOnChart_s = True) then begin

   Print(TimeNow, "CurrentBar: ", NumToStr(CurrentBar, 0),
         ", BarSpacing: ", NumToStr(GetAppInfo(aiBarSpacing), 0),
         ", aiHighestDispValue: ", NumToStr(GetAppInfo(aiHighestDispValue), numDeci),
         ", aiLowestDispValue: ", NumToStr(GetAppInfo(aiLowestDispValue), numDeci),
         ", aiLeftDispDateTime: ", FormatTime("HH:mm:ss", GetAppInfo(aiLeftDispDateTime)),
         ", aiRightDispDateTime: ", FormatTime("HH:mm:ss", GetAppInfo(aiRightDispDateTime)));

end;
These users thanked the author JoshM for the post:
arjfca

arjfca
Posts: 1263
Joined: 23 Nov 2010
Has thanked: 717 times
Been thanked: 221 times

Re: Getappinfo(High, Low, Time): When is this values reavalu

Postby arjfca » 17 Jul 2012

'm not sure if I follow you; since here the indicator that updates on every tick shows the changing the GetAppInfo values if the bar spacing changes (note in the output below that the CurrentBar remains the same, but the BarSpacing is changed -- and so does the output from GetAppInfo on every tick):


I see that in your case the value do change. A will wait for a new time line to be display. I unchecked the Skip identical tick. Good chance that it was the problem.

Here is selection of my code. This indicator is use to display a vertical time line above and under the bar that appeared at the given time

As you can see, the GetAppInfo function are the first instructions and it is not conditionnal meaning always tested.


Whit your answer to my question, I did learn 2 new thing,
- once cleardebug;
- Mouse event ( not studied yet)

Martin :)

Code: Select all

Inputs:

ComputeOnlyVisible (true),
DisplayAsia (False),
DisplayLondon (False),
DisplayNewYork (False),
   
Asian_1 (2000),
Asian_2 (0200),

LondonKillZone_1 (0200),
LondonKillZone_2 (0300),
LondonKillZone_3 (0400),
LondonKillZone_4 (0500),
LondonKillZone_5 (0600),
LondonKillZone_6 (0330),
LondonKillZone_7 (0430),

NewYork_1 (0700),
NewYork_2 (0800),
NewYork_3 (0900),
NewYork_4 (1000),

Ses1Color (Blue),
Ses2Color(Green),
Ses3Color(Red);


Var:
LeftTime (0),
RightTime (0),
UpperPrice (0),
LowerPrice (0),
LineTime_1 (0),
LineNumHigh_Intra (0),
LineNumLow_Intra (0),
Offset(0),
HighIntra (0),
LowIntra (0),
StartTheHighLow (false);
 
Offset = 50* Minmove/PriceScale;
//LineTime_2 = calctime_S(lineTime,120);

Lowerprice = getappinfo(ailowestDispValue);
UpperPrice = getappinfo(aiHighestDispValue);

If ComputeOnlyVisible = true then begin
  If VisibleDate_Time = true then begin
   If displayAsia = true then begin
      If Time >= Asian_1 and time[1] < Asian_1 then begin
         Value1 = TL_New_S(D,Time_S,H+(Offset),D,Time_S,UpperPrice);
         TL_SetColor(Value1,Ses1Color);
         TL_SetStyle(Value1,Tool_dashed);
         TL_SetSize(Value1,0.5);
         Value10 = TL_New_S(D,Time_s,l-offset,D,Time_S,LowerPrice);
         TL_SetColor(Value10,Ses1Color);
         TL_SetStyle(Value10,Tool_Dashed);
         TL_SetSize(Value10,0.5);
      End;
These users thanked the author arjfca for the post:
JoshM


Return to “MultiCharts”