NexusFi: Find Your Edge


Home Menu

 





Help finishing a script plotting opening 30 min levels


Discussion in ThinkOrSwim

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




 
Search this Thread

Help finishing a script plotting opening 30 min levels

  #1 (permalink)
nueces123
Austin, Texas
 
Posts: 1 since Aug 2019
Thanks Given: 0
Thanks Received: 0

Hello,
I need help finishing a script I pieced off of here. I want to plot the high, low and then 25%, 50% and 75%of the opening 30 minute range. The script I have pasted does this but then it goes to the next 30 minutes and plots the high, low etc. of that and so on and so on as the pic I have attached shows. I just want the first 30 minutes plotted and then for those levels to extend for the rest of the day. Any help is appreciated. The way I plan to use this is those levels tend to be important levels the rest of the day, especially the 50% mark. It is based off the Michael Shadkin rules.



plot hod = high(period = AggregationPeriod.THIRTY_MIN);
hod.SetDefaultColor(CreateColor(245, 127, 23));

plot lod = low(period = AggregationPeriod.THIRTY_MIN);
lod.SetDefaultColor(CreateColor(245, 127, 23));

def range = hod - lod;

plot hod764 = (range * 0.75) + lod;
hod764.SetDefaultColor(CreateColor(251, 192, 45));

plot lod236 = (range * 0.25) + lod;
lod236.SetDefaultColor(CreateColor(251, 192, 45));

plot mid50 = (range * 0.5) + lod;
mid50.SetDefaultColor(CreateColor(255, 235, 59));


hod.SetPaintingStrategy (PaintingStrategy.HORIZONTAL);
lod.SetPaintingStrategy (PaintingStrategy.HORIZONTAL);
hod764.SetPaintingStrategy (PaintingStrategy.HORIZONTAL);
lod236.SetPaintingStrategy (PaintingStrategy.HORIZONTAL);
mid50.SetPaintingStrategy (PaintingStrategy.HORIZONTAL);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Increase in trading performance by 75%
The Elite Circle
Exit Strategy
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #2 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35

The issue is that your aggregation period is simply looking at the 30 minute time buckets. You need to delineate which 30 minute period you are interested in. Check out this well commented example from reddit:
 
Code
input opentime = 0930;
input ORend = 1000;
input opacity = .7;
def na = Double.NaN;
#
# Check if the opening range time is now
#
def ORActive = if GetLastDay() == GetDay() and SecondsFromTime(opentime) >= 0 and SecondsFromTime(ORend) < 
0 then 1 else 0;
#
# Track the OR high and low
#
def ORHigh = if ORActive then high else na;
def ORLow = if ORActive then low else na;
#
# Plot the OR high and low
#
plot ORAH = if GetLastDay() != GetDay() or !ORActive then na else HighestAll(ORHigh);
plot ORAL = if GetLastDay() != GetDay() or !ORActive then na else LowestAll(ORLow);
plot ORH = if GetLastDay() != GetDay() or SecondsFromTime(ORend) < 0 then na else HighestAll(ORHigh);
plot ORL = if GetLastDay() != GetDay() or SecondsFromTime(ORend) < 0 then na else LowestAll(ORLow);
#
# Formatting
#
ORAH.SetStyle(Curve.SHORT_DASH);
ORAL.SetStyle(Curve.SHORT_DASH);
ORAH.SetDefaultColor(Color.GREEN);
ORAL.SetDefaultColor(Color.RED);
ORH.SetStyle(Curve.SHORT_DASH);
ORL.SetStyle(Curve.SHORT_DASH);
ORH.SetDefaultColor(Color.GREEN);
ORL.SetDefaultColor(Color.RED);
#
# Add Cloud creates the shading
#
AddCloud(ORH, ORL);
AddCloud(ORAL, ORAH);
#
# Alerts:
#
def alerttrigger = if (high >= ORH and low <= ORH) or (high >= ORL and low <= ORL) then 1 else 0; #replace the 1 with 
your definition
# BLOCK CODE BELOW
input alerttext = "OR Breakout!";
input UseAlerts = {false, default true};
input AlertType = {default "BAR", "ONCE", "TICK"};
def at = AlertType;
input AlertSound = {"Bell", "Chimes", default "Ding", "NoSound", "Ring"};
Alert(alerttrigger and UseAlerts, alerttext, if at == 1 then Alert.ONCE else if at == 2 then Alert.TICK else Alert.BAR, 
AlertSound);
modify that with your fibs, desired colors, and painting styles and voila!

Follow me on Twitter Reply With Quote




Last Updated on September 10, 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