Draw a box around the overnight and Europe(or London) session on Futures Intraday charts

S

SimpleScript

New member
The idea is to drawing the box around the overnight session, and another box to highlight the Europe or London session, to allow easy visual identification/exchange attribution for any identified support/resistance areas. Want this to work on any Intraday aggregation.

did a bunch of poking around tonite, and what Im thinking might work is to

1) input the start and stop times for the sessions (these below are just examples)

input EUOpen = 0100;
input RTHOpen = 0900;
input RTHClose = 1600;
input AsiaOpen = 1800;

2) use conditional logic to then allow addcloud to paint the boxes to the high and lo of those periods

am I on the right track here?
is there a better way to get RTH/ETH/exchange market hours?
do I need to use secondstilltime? to set the desired range?
what's the best way to capture the max hi and low for that specified time period? use High or HighestAll functions?
TIA
 
S

SimpleScript

New member
ok I have the code written to draw the box between the times being input, and set 2 test variables to plot the horizontals in the time period of interest. it appears to work.

now I just have to figure out how to capture the highest high and the lowest low for the desired period as set.

do I need to setup a loop of some kind, or is there a function like HighestAll that will return the value based on the AlertPeriod being True without the need for a loop?

here's the code:

Code:
# plot Data = close;
# ETH highlight
# dec DFKTMA == "SimpleScript";
# by DFK & Associates.  Copyright 2020. This code is distributed freely without restriction.  Use in any way absolves author of any and all liability.

#input EUOpen = 0100;
#input AsiaOpen = 1800;
input RTHOpen = 0900;
input RTHClose = 1600;

def hhtest = 2750;
def lltest = 2500;
input HideBoxLines = Yes;
input HideLabels = Yes;

def StartAlertPeriod = SecondsFromTime(RTHClose);
def EndAlertPeriod = SecondsTillTime(RTHOpen);

def AlertPeriod = if StartAlertPeriod >= 0 or EndAlertPeriod >= 0 then 1 else 0;

#def HH = HighestAll(if alertPeriod = 1);
#def LL = LowestAll;

plot BoxHH = HighestAll (if alertPeriod then hhtest else Double.NaN);
BoxHH.SetDefaultColor(Color.GRAY);
BoxHH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BoxHH.SetHiding(HideBoxLines);

plot BoxLL = LowestAll (if alertPeriod then lltest else Double.NaN);
BoxLL.SetDefaultColor(Color.GRAY);
BoxLL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BoxLL.SetHiding(HideBoxLines);

AddCloud(if alertPeriod then BoxHH else Double.NaN, if alertPeriod then BoxLL else Double.NaN, Color.GRAY, Color.GRAY);
 
S

Shaishen

New member
TOS has a built in Cumulative ON Volume study - you can color the bars for Asia & EU to your liking - RTH IB and remainder of the RTH can also be colored - gives you a nice visual.
Bottom pane shows ONvol bars and average ON vol.
It is a well thought out indicator imo.
.
 
S

SimpleScript

New member
TOS has a built in Cumulative ON Volume study - you can color the bars for Asia & EU to your liking - RTH IB and remainder of the RTH can also be colored - gives you a nice visual.
Bottom pane shows ONvol bars and average ON vol.
It is a well thought out indicator imo.
.
yes that is interesting ty for that. at this point, Im in it far enough to where I want to understand how to build the syntax to reach the goal of grabbing the hi and low in the time period of interest, and plotting a box around that. thinkscript is challenging due to how in some ways it is automagically recursive, and in others it is linear...
 
S

SimpleScript

New member
here's my latest trainwreck of an effort to get the hi and low in the as-input time period. it gets the box drawn at the correct start and stop time, but the hi's and low's aren't getting identified properly. and it seems to be a very intensive study. perhaps I need to limit how far back it can go?

I need to step away from it, let my mind clear... if anyone has any suggestions on getting the hi & low for the input time period, that would be hugely appreciated!

Code:
# plot Data = close;
# ETH highlight
# dec DFKTMA == "SimpleScript";
# by DFK & Associates.  Copyright 2020. This code is distributed freely without restriction.  Use in any way absolves author of any and all liability.

#input EUOpen = 0100;
#input AsiaOpen = 1800;
input RTHOpen = 0900;
input RTHClose = 1600;

#def hhtest = 2750;
#def lltest = 2500;
input HideBoxLines = Yes;
input HideLabels = No;

def StartAlertPeriod = SecondsFromTime(RTHClose);
def EndAlertPeriod = SecondsTillTime(RTHOpen);

def AlertPeriod = if StartAlertPeriod >= 0 or EndAlertPeriod >= 0 then 1 else 0;

def period_type = AggregationPeriod.day;
#def period_type = getAggregationPeriod();

def begin = close(period = period_type)[1];
def end = close(period = period_type);

def LL = low (period = period_type[1]);
def HH = high (period = period_type[1]);
#def HH = HighestAll(period_type);
#def LL = LowestAll(period_type);

plot BoxHH = HighestAll (if AlertPeriod then HH else Double.NaN);
BoxHH.SetDefaultColor(Color.GRAY);
BoxHH.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BoxHH.SetHiding(HideBoxLines);

plot BoxLL = LowestAll (if AlertPeriod then LL else Double.NaN);
BoxLL.SetDefaultColor(Color.GRAY);
BoxLL.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
BoxLL.SetHiding(HideBoxLines);

AddCloud(if AlertPeriod then BoxHH else Double.NaN, if AlertPeriod then BoxLL else Double.NaN, Color.GRAY, Color.GRAY);
 
T

Troy

New member
Hello all, yes I did do a search and found only 1 thread on this subject with no real follow-up. I am specifically looking for an indicator or if someone can code one that draws a color coded box from high to low, wick to wick from each desired time session. Example on my MT4 platform I use an isessions indicator, this indicator draws a rectangular box from high to low during Asia, 8-11 pm, then London 2-5am, then the US session 8-11am. 3 seperate boxes that I can adjust the time and color. I have searched all over the internet and the closest thing I've seen is some kind of breakout range which is not what I am looking for. Can someone please steer me in the right direction. I trade forex mostly, that why I need something that can draw individual boxes for times. I have inserted an image so you can see exactly what I am looking for. Thank you.

 
Last edited:
T

Troy

New member
Hopefully someone sees this and would be willing to help me out here, even willing to pay money but I see that there seems to be not a lot of interest if anyone asks anything related to forex. Just looking for an indicators that draws a box from high to low, wick to wick from the times I set forth and colors being able to be changed. Example 8-11 pm blue box high to low wick to wick, 2 to 5 am yellow box high to low wick to wick 8 to 11am green box high to low wick to wick, or whatever color we desire.
 

Similar threads

Top