NexusFi: Find Your Edge


Home Menu

 





Help with OR script alerts


Discussion in ThinkOrSwim

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




 
Search this Thread

Help with OR script alerts

  #1 (permalink)
rtucek
Chicago Ill. US
 
Posts: 2 since Mar 2017
Thanks Given: 0
Thanks Received: 0

Hi all,
I am somewhat of a newbie to thinkscript and have been pulling my hair out trying to get this script to do what I want.
If someone could help, it would be greatly appreciated.
The script plots the ORH & ORL on the chart and alerts when price crosses above the ORH, But I would like to be able to control the time period when the alert triggers. The code is below:

# Automatic Opening Range With ORH/ORL Alerts
#
# This Thinkscript is designed to plot the OR high & low,
# This will only work correctly on time-based charts,
# where the OR timeframe is divisible by the bar period
# e.g. 30 minute OR, 10 min bars.
#
input agg = AggregationPeriod.Fifteen_MIN;
# Show Today only?(Default Yes)
input ShowTodayOnly = Yes;
def today = if !ShowTodayOnly then 1 else GetDay() == GetLastDay();
def lookback = SecondsFromTime(0930) / GetAggregationPeriod() * 1000;
# Plot OR range
plot ORh = if !today then double.nan else GetValue(high(period = agg), lookback);
ORh.Setstyle(curve.Long_DASH);
ORh.SetDefaultColor(color.green);
ORh.SetLineWeight(1);
plot ORl = if !today then double.nan else GetValue(low(period = agg), lookback);
AddCloud(ORH,ORL);
# Color formatting
ORl.SetStyle(curve.Long_DASH);
ORl.SetDefaultColor(color.red);
ORl.SetLineWeight(1);
#Trigger Alerts on breach of Opening Range High
#
alert(close>=ORH,”ORH b/o”,alert.ONCE,sound.DING);

Reply With Quote




Last Updated on March 21, 2017


© 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