NexusFi: Find Your Edge


Home Menu

 





Plot RTH values on ETH chart.


Discussion in ThinkOrSwim

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




 
Search this Thread

Plot RTH values on ETH chart.

  #1 (permalink)
 Stocktrader 
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
Posts: 18 since Mar 2012
Thanks Given: 4
Thanks Received: 7

Hi and thanks for taking a look.

I am trying to plot yesterdays RTH high, low & close on todays ETH chart in TOS. I have used some script from the profile indys to get this far. I am stumped on defining the time period though to get the value I am looking for and could do with others input please. How do I arrange all the elements to give me a value to plot?

ie Define yesterdays RTH. Find the highest high. Plot it on todays chart. Do the same for the Low and Close.

I can do the plotting and rework the code for the Low and Close - just need help defining the RTH and getting the value.

I have resigned myself to using a manual input for the RTH hours as I couldn't get the TOS function 'RegularTradingStart' 'RegularTradingEnd' to work in a script and I cant find a 'Get' function that you would use in C. However if there is a genius out there that can find a way of automating this I would be truly grateful.

So far I have:

input rthbegin = 0930;
input rthend = 1400;

def rth = secondsfromTime(rthbegin)>=0 and secondstillTime(rthend)>0;
def cond = rth[1] != rth;

#script to get the right day

def day = GetDay();
def lastDay = GetLastDay();
def isToday = If(day == lastDay, 1, 0);
def pastOpen = If((SecondsTillTime(rthbegin) > 0), 0, 1);
def pastClose = If((SecondsTillTime(rthend) > 0), 0, 1);
def marketOpen = If(pastOpen and !pastClose, 1, 0);
def firstBar = If (day[1] != day, day - 1, 0);
def date = getyyYYMMDD();

#Highest High during RTH

def yRthHi = ? How do I get the script to give me the highest high of the bar numbers that just fall within the RTH session ?

#Plot the value

Plot YestRthHi = yRthHi;


Thanks for taking a look - all contributions gratefully received.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quantum physics & Trading dynamics
The Elite Circle
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
 
  #2 (permalink)
 Stocktrader 
Dublin Ireland
 
Experience: Intermediate
Platform: Ninja, TOS
Broker: RCG Direct/Continuum
Trading: ZB
Posts: 18 since Mar 2012
Thanks Given: 4
Thanks Received: 7

Had some help from these guys https://www.hahn-tech.com/
Here is a solution for anybody else looking for something similar:

input daysToPlot = 10;

def regularSessionHours = RegularTradingStart(GetYYYYMMDD()) <= GetTime()and RegularTradingEnd(GetYYYYMMDD())>= GetTime();
def extendedSessionHours = RegularTradingStart(GetYYYYMMDD()) >= GetTime();
def regularSessionStart = extendedSessionHours[1] and regularSessionHours;
def extendedSessionStart = regularSessionHours[1] and extendedSessionHours;

def okToPlot = GetLastDay() - daysToPlot <= GetDay();

def regularSessionHigh = CompoundValue(1, if regularSessionStart then high else if regularSessionHours then Max(high, regularSessionHigh[1]) else regularSessionHigh[1], 0);

def regularSessionLow = CompoundValue(1, if regularSessionStart then low else if regularSessionHours then Min(low, regularSessionLow[1]) else regularSessionLow[1], 0);

def regularSessionOpen = CompoundValue(1, if regularSessionStart then open else if regularSessionHours then regularSessionOpen[1] else regularSessionOpen[1], 0);

def regularSessionClose = CompoundValue(1, if regularSessionHours then close else if extendedSessionHours then regularSessionClose[1] else regularSessionClose[1],0);

plot yestRthHi = if okToPlot and extendedSessionHours then regularSessionHigh else Double.NaN;
plot yestRthLo = if okToPlot and extendedSessionHours then regularSessionLow else Double.NaN;
plot yestRthOpen = if okToPlot and extendedSessionHours then regularSessionOpen else Double.NaN;
plot yestRthClose = if okToPlot and extendedSessionHours then regularSessionClose else Double.NaN;

Started this thread Reply With Quote
Thanked by:
  #3 (permalink)
Doncorleone
Seattle
 
Posts: 11 since Mar 2011
Thanks Given: 4
Thanks Received: 1


do you happen to know how to extend the lines(yesRTHOpen and yesRTHClose) so they plot until end of trading session?

Reply With Quote




Last Updated on January 31, 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