NexusFi: Find Your Edge


Home Menu

 





ThinkScript Compund Value


Discussion in ThinkOrSwim

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




 
Search this Thread

ThinkScript Compund Value

  #1 (permalink)
 
BTR411's Avatar
 BTR411 
NY, NY/USA
 
Experience: Advanced
Platform: Investor/RT and TT XT
Broker: DTN IQFeed, Rthmic, TT-NET
Trading: Energy Futures
Posts: 222 since Mar 2013
Thanks Given: 196
Thanks Received: 1,179

I was wondering if anyone could help interpret two lines of ThinkScript code from the VSA indicator.

The first is:

rec avgVolume = CompoundValue(volumeEMALength, ExpAverage(volume, volumeEMALength), Double.NaN)

and the second:

rec sAvgVolume = CompoundValue(volumeEMALength, Average(volume, volumeEMALength), Double.NaN);


I initially thought that the first one was simply an EMA of the volume, but the presence of the CompoundValue(volumeEMALength, is throwing me off.

The second appeared to be just the simple average of the volume, but again, I am having a hard time understanding the beginning.



Could someone shed some light on what these two lines of code are actually measuring and the logic behind it.


I checked the TOS website and am having hard time making sense of the explantion in regard to compound value and this specific code.

Thank you in advance for the help

If you can keep your wits about you while all others are losing theirs, and blaming you....The world will be yours and everything in it, what's more, you'll be a man, my son. - Kipling
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
Cheap historycal L1 data for stocks
Stocks and ETFs
REcommedations for programming help
Sierra Chart
About a successful futures trader who didnĀ“t know anyth …
Psychology and Money Management
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
aryaclid
dakota
 
Posts: 1 since Jul 2019
Thanks Given: 0
Thanks Received: 0

Hey,

Did you figure out what this compoundvalue function does and why its being used - whats any other similar function in other languages (Python,c#) if any...

Reply With Quote
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


BTR411,

from the code snippets it appears the CompoundValue should make sure that the averages have enough bars present before they are used.
If the bar number on the chart is greater than the value for volumeEMALength CompoundValue would return the value for ExpAverage(volume, volumeEMALength) otherwise it would return Double.NaN.

Additionally the link below might help clarifying things for you:
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Others/CompoundValue.html

Regards,

ABCTG

Follow me on Twitter Reply With Quote




Last Updated on August 1, 2019


© 2024 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