NexusFi: Find Your Edge


Home Menu

 





[tos] Define bodyheight of green candles only?


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one rmejia with 5 posts (4 thanks)
    2. looks_two growex with 4 posts (4 thanks)
    3. looks_3 Massive l with 4 posts (0 thanks)
    4. looks_4 givemethenews99 with 1 posts (0 thanks)
    1. trending_up 5,775 views
    2. thumb_up 8 thanks given
    3. group 3 followers
    1. forum 12 posts
    2. attach_file 7 attachments




 
Search this Thread

[tos] Define bodyheight of green candles only?

  #1 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

Any ideas? I can't seem to nail it down. Seems simple enough though.

Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
ZombieSqueeze
Platforms and Indicators
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Exit Strategy
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
38 thanks
NexusFi site changelog and issues/problem reporting
27 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #2 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

@rmejia

Any thoughts on this?

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #3 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441


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.

Reply With Quote
  #4 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

I want them added up over a period.

This is what I have. This is green - red.
I want total bodyheight of green for n periods divided by bodyheight of red for n periods

declare lower;
input length = 70;
def green = close > open;
def red = close < open;
def bodyheight = BodyHeight();
plot difference1 = sum(green, length) / Sum(red, length);
PLOT ZeroLine = 1;

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

It's counting something, not sure what it is tho. Was looking for info on counting or series but not much in the thinkscript manual.

Maybe something on this thread can help:
Login | ThinkScripter

Have you looked in the yahoo thinkscript group? There is a crazy amount of info there, best free resource for thinkscript ideas imo.

Reply With Quote
Thanked by:
  #6 (permalink)
 
Massive l's Avatar
 Massive l 
OR/USA
Legendary /NQ Trader
 
Experience: None
Posts: 2,129 since Mar 2011
Thanks Given: 1,859
Thanks Received: 5,106

It's just taking the sum of all the green candles and dividing it by the sum of the red.
I need the sum of the bodyheight of the green / red.

I'll check yahoo but probably not going to see much. I've already googled it many times.

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

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.

Reply With Quote
Thanked by:
  #8 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79

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;

Please let me know if it works

Follow me on Twitter Reply With Quote
Thanked by:
  #9 (permalink)
 
rmejia's Avatar
 rmejia 
Puerto Rico
 
Experience: Intermediate
Platform: thinkorswim
Broker: TD Ameritrade
Trading: Options
Posts: 379 since Oct 2010
Thanks Given: 3,614
Thanks Received: 441

Sorry to hear they are not letting you log into your thinkorswim account.

Pasted the code but getting this:

Reply With Quote
  #10 (permalink)
 growex 
Trubchevsk
 
Experience: Beginner
Platform: tos
Trading: stocks
Posts: 61 since May 2011
Thanks Given: 40
Thanks Received: 79



rmejia View Post
Sorry to hear they are not letting you log into your thinkorswim account.

Pasted the code but getting this:



ok...got it...
getvalue(close-open,i,length-1)

there's a comma missed after "i" and "j" in getvalue function

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on December 30, 2020


© 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