NexusFi: Find Your Edge


Home Menu

 





Calculate cumulative sum from session start


Discussion in MultiCharts

Updated
    1. trending_up 1,173 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
hhomsi8
Stockholm, Sweden
 
Posts: 10 since Feb 2023
Thanks Given: 7
Thanks Received: 0

Hi,

is it possible for someone to help me get the cumulative sum from start of the trading session/or if easier from specified starting time?

i will be using it for stocks (so I won't be having issues with different trading session starts). For instance, I just need to get the logic correct so I can use it in my testing.

for instance, if I want the cumulative sum of upticks from start of the session:

HTML Code:
inputs: sessionStart(1530), sessionEnd(2200),length(9);

var: cumupTicks(0);

if Time >= sessionStart and Time <= sessionEnd then 
    cumupTicks += Upticks  else cumupTicks = 0;


plot1( ccumupTicks , "Cumulative Upticks", Green );
or is it better to do:

HTML Code:
inputs: sessionStart(1530), sessionEnd(2200),length(9);

var: cumupTicks(0);

if Date <> Date[1] then 
    cumupTicks += Upticks  else cumupTicks= 0;


plot1( ccumupTicks , "Cumulative Upticks", Green );
Or How should it be? I appreciate any help.

Thanks in advance


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
CFTC Rewrites the Rulebook -- Kalshi Cracks $1B Non-Spor …
Prediction Markets & Event Contracts
Sundays Verdict: Lebanon Locked at 99.85% as Iran June 7 …
Prediction Markets & Event Contracts
Iran and Israel Stand Down: What $9M in Peace Contracts …
Prediction Markets & Event Contracts
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
The Pivot Point 113.6³ — Navigating the Prediction of …
26 thanks
Sober Journey With S&P
17 thanks
The Confluence Meter: A Multi-Layered Signal Framework B …
11 thanks
NT8 color choices
10 thanks
Volume Indicators
7 thanks
  #2 (permalink)
artisanpro
montreal, qc, canada
 
Posts: 28 since May 2021
Thanks Given: 28
Thanks Received: 18

I am answering in relation to Multicharts Power Language:

will NOT work -------------- cumupTicks += Upticks else cumupTicks = 0;

will work -------------------- cumupTicks = Upticks + cumupTicks[1] else cumupTicks = 0;


Now, in regards to your question of date vs session start, they both should work but which one is more efficient is unknown to me.

I have always wondered if there is a way to catch how fast an indicator executes - something similar to Excel VBA where you can actually measure the execution time.
I would be very happy if someone knows how to do this.


Reply With Quote
  #3 (permalink)
hhomsi8
Stockholm, Sweden
 
Posts: 10 since Feb 2023
Thanks Given: 7
Thanks Received: 0



artisanpro View Post
I am answering in relation to Multicharts Power Language:

will NOT work -------------- cumupTicks += Upticks else cumupTicks = 0;

will work -------------------- cumupTicks = Upticks + cumupTicks[1] else cumupTicks = 0;


Now, in regards to your question of date vs session start, they both should work but which one is more efficient is unknown to me.

I have always wondered if there is a way to catch how fast an indicator executes - something similar to Excel VBA where you can actually measure the execution time.
I would be very happy if someone knows how to do this.

Thanks a lot for taking the time to answer, Appreciate ur help. Just 1 more thing, wouldn't ur code cumupTicks = Upticks + cumupTicks[1] only sum the prev's bar tick instead of accumulating the values from count of 0? or have I misunderstood the logic?


Reply With Quote
  #4 (permalink)
artisanpro
montreal, qc, canada
 
Posts: 28 since May 2021
Thanks Given: 28
Thanks Received: 18

No, this will do the cumulative.

At bar one (1), cumupTicks[1] is zero so
cumupTicks is = Upticks + 0 ;

At bar two (2), cumupTicks[1] is = Upticks[1] so
cumupTicks = Upticks + cumupTicks[1] or
cumupTicks = Upticks + upTicks[1]

At bar three (3), cumupTicks[1] is = Upticks[1] + Upticks[2] so
cumupTicks = Upticks + cumupTicks[1] or
cumupTicks = Upticks + Upticks[1] + Upticks[2]

and so on


Reply With Quote
Thanked by:




Last Updated on June 4, 2023


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts