How to reset studies every x second

Questions about MultiCharts and user contributed studies.
Bthomas
Posts: 3
Joined: 15 Jul 2022

How to reset studies every x second

Postby Bthomas » 06 Sep 2022

I’m new ti multicharts and programming , I’m trying to programe a loop that evry x seconds reset my volume based study . I don’t now how to start, can you help me?

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: How to reset studies every x second

Postby TJ » 07 Sep 2022


Bthomas
Posts: 3
Joined: 15 Jul 2022

Re: How to reset studies every x second

Postby Bthomas » 08 Sep 2022

can someone help me with this code? I don't know how to reset value 2 every 60 seconds.

Code: Select all

// Volume Momentum V 1.0 By Thomas Battaini inputs: Timer (60), CandleVol (60000), AvgCandle (0); Var: VolSum (0), Counter (0); // Set condition of computing only on specified bar type if BarType = 0 and BarType <= 2 then Counter = Volume else Counter = Ticks; //Calculate N.Contract Bar if date <> date[1] then begin value1= 0; value2= 0; end; if Counter > 0 then value1 = (value1 + Counter) / CandleVol; if value1 > 0 then value2 = value2 + value1 ; plot1( value1 ," Volume Momentum"); plot2(value2,"Volume Sum")
I want set a timestamp to reset the volume sum and then apply a average on the all value2 with auto resetting , so I can see the volume impulse and it relative divergence to have a better analysis.

There aren't prebuilt function that do this feature, someone can light me one possible way to resolve the problem?

Thanks,Bthomas


Return to “MultiCharts”