NexusFi: Find Your Edge


Home Menu

 





Extend horizontal line plot


Discussion in ThinkOrSwim

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




 
Search this Thread
  #1 (permalink)
pr0crast
Tucson, AZ
 
Posts: 2 since Mar 2011
Thanks Given: 0
Thanks Received: 0

Hi all,

Is it possible to plot something on a PREVIOUS bar based on a condition met by a LATER bar?

For example, this script creates a lateral boundaries based on the logic that two inside bars followed an initial bar, and bars 4+ closed within the range of the initial bar. The only problem is because the condition to generate the lateral lines is only met by the 3rd bar, I cannot get the line to extend to the first two bars retroactively. Any guidance would be appreciated.

Here's the code:

 
Code
declare upper;
declare real_size;
rec inLateralBar3 = high[0] <= high[2] && high[1] <= high[2] && low[0] >= low[2] && low[1] >= low[2];
rec inLateralBar4 = inLateralBar3[1] && close <= high[3] && close >= low[3]; 
rec inLateralBar5 = inLateralBar4[1] && close <= high[4] && close >= low[4];

plot LatTop = if inLateralBar3[0] then (high[2])
    else if InLateralBar4[0] then (high[3]) 
    else if inLateralBar5[0] then (high[4])
    else Double.NAN;
LatTop.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LatTop.SetDefaultColor(Color.yellow);
LatTop.SetLineWeight(2);
LatTop.HideBubble();
LatTop.HideTitle();

plot LatBot = if inLateralBar3[0] then (low[2])
    else if InLateralBar4[0] then (low[3]) 
    else if inLateralBar5[0] then (low[4])
else Double.NAN;
LatBot.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
LatBot.SetDefaultColor(Color.yellow);
LatBot.SetLineWeight(2);
LatBot.HideBubble();
LatBot.HideTitle();
Result:

h t t p : / / content.screencast.com/users/anon233/folders/Snagit/media/36c8dab3-91c3-4445-9152-e42ab04a5f1b/03.27.2011-20.57.25.png

(sorry, can't post images -- don't have 5 posts yet)


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
No book, only a stair: journaling fills where price move …
Cryptocurrency
EA
Platforms and Indicators
My Rant with AMP Futures
Trading Reviews and Vendors
Datafeed for Atas
Platforms and Indicators
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
TopStep Trader disappointment
2 thanks
Johnnys Journal
2 thanks
  #2 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,099 since Jun 2009
Thanks Given: 877
Thanks Received: 8,098

pic from link, a lateral formation

could you draw them first and delete them when condition is not met.


Attached Thumbnails
Click image for larger version

Name:	lat.png
Views:	327
Size:	4.2 KB
ID:	35144  
Reply With Quote
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,099 since Jun 2009
Thanks Given: 877
Thanks Received: 8,098


have you try this resource
Thinkscript Overview Read the Prospectus
this looks promising
Shaded Opening Range Indicator for Think or Swim Read the Prospectus


Reply With Quote
  #4 (permalink)
 
WildWex's Avatar
 WildWex 
Tarzana, CA
 
Experience: Intermediate
Platform: TOS, TS, MC, NT8, MT4
Trading: Futures: ES, CL, NQ, HO, SI
Posts: 9 since Jul 2017
Thanks Given: 6
Thanks Received: 6

Hey Pr0crast -

Did you ever figure this out?


Reply With Quote
  #5 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,099 since Jun 2009
Thanks Given: 877
Thanks Received: 8,098


WildWex View Post
Hey Pr0crast -

Did you ever figure this out?

he's not going to answer you after after just 1 post in 6 years.


Reply With Quote




Last Updated on January 7, 2018


© 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