Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for 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
(If you already have an account, login at the top of the page)
Is it only for the last candle or for a series of them; for the last one if close>open would be green then close-open should give the body size. Would need a [1] to go back but it would be moving so once another green one comes up it would change the last given green candle size data.
Tried something but it fails on an issue I don't know how, or if possible, with thinkorswim, which is to define specific bars:
plot GreenSum = if green then sum(bodyheight(), length) else double.nan;
plot RedSum = if red then sum(bodyheight(), length) else double.nan;
The issue is the:
def green = close > open;
def red = close < open;
Is checking for the actual live price, so the condition is if right now price is green then plot. Don't know how to reference back historical green and red bars.
As i'm russian, i can't have a thinkorswim account anymore...my one was banned totally two days ago...
Ok mates...i can not test it but try this recursive fold statement.
input length = 70;
def green = fold i=0 to length with n = 0 do if getvalue(close-open,i length-1)>0 then n+close-open else n;
def red = fold j=0 to length with k = 0 do if getvalue(close-open,j length-1)<0 then k+open-close else k;
plot ratio = green/red;