Alert -- If Realtime Data is Disconnected between time

Questions about MultiCharts and user contributed studies.
Tibouss
Posts: 35
Joined: May 26 2022
Has thanked: 9 times
Been thanked: 1 time

Mar 13 2024

Hello

I have some trouble to make this code active only during a certain stime slot.

Actually i'm using session time between 15h to 22h but when i activate the code before 15h alerts are triggered.

I tried to add some conditions but it doesn't change anything (code below).

Code: Select all

[IntrabarOrderGeneration = true] Inputs : starttime (1500), endtime(2200); Vars: intrabarpersist counter(0); If time >= starttime and time<= endtime then begin Recalclastbarafter(5); counter = IFF(getappinfo(aicalcreason) = calcreason_timer, counter + 1, 0); if counter > 6 then alert("No realtime > 30 sec"); end;

Can someone let me know what's wrong with the code to activate it only between 15h to 22H?

Many thanks in advance

User avatar
TJ
Posts: 7775
Joined: Aug 29 2006
Location: Global Citizen
Has thanked: 1036 times
Been thanked: 2233 times

Mar 14 2024

Why are you using intrabarpersist ?

Tibouss
Posts: 35
Joined: May 26 2022
Has thanked: 9 times
Been thanked: 1 time

Mar 15 2024

Actually i was using the code in the thread below :

viewtopic.php?f=5&t=11715

I'm using intrabarpersist because the alert is supposed to be triggered after 30 seconds of connections loss while i'm using a 5 minutes timeframe chart.

I'm getting trouble to get this script working by code only during a certain time slot.

Tibouss
Posts: 35
Joined: May 26 2022
Has thanked: 9 times
Been thanked: 1 time

Apr 02 2024

I found a solution, here is the code if someone is interested :

Code: Select all

[IntrabarOrderGeneration = true] Input: stime(1100), etime(1800); Vars: intrabarpersist counter(0), ii(0); Recalclastbarafter(5); counter = IFF(getappinfo(aicalcreason) = calcreason_timer, counter + 1, 0); if counter > 6 and time > stime and time <etime then begin if ii=0 then ii+=1; alert("No realtime > 30 sec"); end;