Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

dimsontt

Coding for Thinkorswim Platform

Recommended Posts

I have some experience with thinkorswim. What are you looking to do?

 

adonis.. could you help me with this? I need to modify this opening range script to draw an additional line at the market's open and have no clue what to do..

 

# TS_OpeningRange

# ThinkScripter – Custom ThinkScript Indicators for thinkorswim

# thinkscripter@gmail.com

# Last Update 01 SEP 2009

 

input showOnlyToday = YES;

input openingRangeMinutes = 60;

input Market_Open_Time = 0930;

input Market_Close_Time = 1600;

 

def day = getDay();

def lastDay = getLastDay();

def isToday = if(day==lastDay,1,0);

def shouldPlot = if(showOnlyToday and isToday, 1,if(!showOnlyToday,1,0));

def pastOpen = if((secondsTillTime(Market_Open_Time) > 0), 0, 1);

def pastClose = if((secondsTillTime(Market_Close_Time) > 0), 0, 1);

def marketOpen = if(pastOpen and !pastClose, 1, 0);

def firstBar = if (day[1] != day, day - 1, 0);

 

def secondsUntilOpen = secondsTillTime(Market_Open_Time);

def regularHours = secondsTillTime(Market_Close_Time);

 

def secondsFromOpen = secondsFromTime(Market_Open_Time);

def pastOpeningRange = if(secondsFromOpen >= (openingRangeMinutes * 60), 1, 0);

 

 

REC displayedHigh = if(high > displayedHigh[1] and marketOpen, high, if(marketOpen and !firstBar, displayedHigh[1], high));

REC displayedLow = if(low < displayedLow[1] and marketOpen, low, if(marketOpen and !firstBar, displayedLow[1], low));

 

rec ORHigh = if(pastOpeningRange, ORHigh[1], displayedHigh);

rec ORLow = if(pastOpeningRange, ORLow[1], displayedLow);

 

plot Opening_Range_High = if(pastOpeningRange and marketOpen and shouldPlot, ORHigh, double.nan);

plot Opening_Range_Low = if(pastOpeningRange and marketOpen and shouldPlot, ORLow , double.nan);

Opening_Range_High.SetDefaultColor(color.green);

Opening_Range_High.SetLineWeight(2);

Opening_Range_High.SetStyle(curve.POINTS);

Opening_Range_Low.SetDefaultColor(color.red);

Opening_Range_Low.SetLineWeight(2);

Opening_Range_Low.SetStyle(curve.POINTS);

Edited by Attila

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.