NexusFi: Find Your Edge


Home Menu

 




Calculate cumulative sum from session start


Discussion in MultiCharts

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




Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now, It is Free
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.

-- Big Mike, Site Administrator

Available coupon codes for premium Elite Membership:
  • If you are a researcher and pay attention to details, you qualify for our 10% discount - "CHARTIST"
  • If you are a veteran or in public/community service, you qualify for 15% discount - "PURPLECHART"
  • If you are 60+ years old, you qualify for our 20% discount - "WISDOM"
  • Discounts are based on the honor system. If we can't trust you to do the right thing, please move along.

(If you already have an account, login at the top of the page)

 
Search this Thread

Calculate cumulative sum from session start

(login for full post details)
  #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?
Time and Price Based Horizontal line Indicator - Request
NinjaTrader
Strategy: second data series for using correct entry tim …
NinjaTrader
ninzaco snow eagle trading
NinjaTrader
Gabriel Grammatidis
Trading Reviews and Vendors
NT8 Historical Data
NinjaTrader
 

(login for full post details)
  #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
(login for full post details)
  #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
(login for full post details)
  #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
The following user says Thank You to artisanpro for this post:





NexusFi Trading Community Platforms and Indicators MultiCharts > Calculate cumulative sum from session start


Last Updated on June 4, 2023


© 2023 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 - Privacy Policy - Downloads - Top
no new posts