NexusFi: Find Your Edge


Home Menu

 





Extend horizontal line plot


Discussion in ThinkOrSwim

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




 
Search this Thread

Extend horizontal line plot

  #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?
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
What broker to use for trading palladium futures
Commodities
Strategy stop orders partially filled
EasyLanguage Programming
Quantum physics & Trading dynamics
The Elite Circle
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
24 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
16 thanks
GFIs1 1 DAX trade per day journal
12 thanks
EG Indicators
11 thanks
  #2 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090

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:	215
Size:	4.2 KB
ID:	35144  
Reply With Quote
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


have you try this resource
Thinkscript Overview Read the Prospectus
this looks promising
Shaded [AUTOLINK]Opening Range[/AUTOLINK] Indicator for [AUTOLINK]Think or Swim[/AUTOLINK] 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,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


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


© 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