Opening Price of any period

T

Trading51

Member
VIP
Warehouse
Opening Price of any period, 60, 120, 240 etc with a horizontal line with a small margin to the right of the chart, lets say a new hour started and you wanted the open of that bar, could some code this? thanks
 
T

Trading51

Member
VIP
Warehouse
Sounds like you want something like this:
i don't know much about coding, how can a preference be added to this where you can add the time of the candle or make one like example the 720 period which is 12 hour, maybe like a drop-down to choose from, let me know and thanks for taking the time cheers
 
T

Trading51

Member
VIP
Warehouse
Can someone help me with this, it seems quite simple but when you have zero programming skills its difficult
 
korygill

korygill

Member
VIP
Warehouse
try this and if it's not want you want, draw a picture of what you want or describe it in greater detail. i am not 100% this is what you are looking for.
http://tos.mx/qmFCgel

Code:
input agg = AggregationPeriod.TWO_HOURS;
def data = close(period = agg);
plot AggClose = if !IsNaN(data) then data else data[1];
 
korygill

korygill

Member
VIP
Warehouse
Update: use this link for Open, i mistakenly used close

Code:
input agg = AggregationPeriod.TWO_HOURS;
def data = open(period = agg);
plot AggClose = if !IsNaN(data) then data else data[1];

Screenshot I put on imgur
 
T

Trading51

Member
VIP
Warehouse
If I wanted to use 12 hour period how would I add that I noticed that TOS didn’t have this aggregation period, btw thanks for taking the time to do this
 
korygill

korygill

Member
VIP
Warehouse
Hmm...for that, a little math is involved.

Maybe this is what you wanted:
 
C

Citizen Quasar

New member
I am seeking to obtain the open/close/high/low of the very first bar and to use this value as the starting point for a horizontal line. Any help or advice will be greatly appreciated. :oops:
 
H

horserider

Well-known member
VIP
Warehouse
I am seeking to obtain the open/close/high/low of the very first bar and to use this value as the starting point for a horizontal line. Any help or advice will be greatly appreciated. :oops:
See if this fits what you want. Let us know how you are using it please.

Code:
# Draw horizontal line at market open price.
# Most code extracted from another study but forgot where.
# By Horserider.

input openingPMTime  = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input openingTime  = 0930.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.

def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);

def isPreMarket = If (GetDay() == GetLastDay() and SecondsTillTime(openingPMTime) < 0, yes, no);
input LineWidth = 1;
def na = Double.NaN;

def isBelowDaily = If (GetAggregationPeriod() < AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def day = GetDay();

def PMopenBar = day != day[1];
def PMOpen = if PMopenBar then open else PMOpen[1];

plot PlotPMOLine = if isToday and isBelowDaily then PMOpen else na;
     PlotPMOLine.SetDefaultColor(CreateColor(77, 166, 255));
     PlotPMOLine.SetLineWeight(LineWidth);
     PlotPMOLine.SetPaintingStrategy(PaintingStrategy.DASHES);
     PlotPMOLine.HideTitle();
     PlotPMOLine.HideBubble();
 
T

Trading51

Member
VIP
Warehouse
See if this fits what you want. Let us know how you are using it please.

Code:
# Draw horizontal line at market open price.
# Most code extracted from another study but forgot where.
# By Horserider.

input openingPMTime  = 0400.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.
input openingTime  = 0930.0; #hint OrMeanS: Begin Mean Period. Usually Market Open EST.

def isDaily = If (GetAggregationPeriod() == AggregationPeriod.DAY, yes, no);

def isPreMarket = If (GetDay() == GetLastDay() and SecondsTillTime(openingPMTime) < 0, yes, no);
input LineWidth = 1;
def na = Double.NaN;

def isBelowDaily = If (GetAggregationPeriod() < AggregationPeriod.DAY, yes, no);
def isToday = If (GetDay() == GetLastDay() and SecondsFromTime(openingPMTime) >= 0, yes, no);
def day = GetDay();

def PMopenBar = day != day[1];
def PMOpen = if PMopenBar then open else PMOpen[1];

plot PlotPMOLine = if isToday and isBelowDaily then PMOpen else na;
     PlotPMOLine.SetDefaultColor(CreateColor(77, 166, 255));
     PlotPMOLine.SetLineWeight(LineWidth);
     PlotPMOLine.SetPaintingStrategy(PaintingStrategy.DASHES);
     PlotPMOLine.HideTitle();
     PlotPMOLine.HideBubble();
Thanks for the rply, the chart is blank am i suppose to do something in the code ?
 
T

Trading51

Member
VIP
Warehouse
what I was trying to do is the following, at a certain time like 6 am or 10 am I wanted a horizontal line at the opening of the bar, so at 720 (6 am) and 240-minute bar (10 am) there would be a horizontal line to the right of the chart maybe not all the way across just by a margin, using this for $ES futures, the above code I tried to see if I could do something but not code orientated for that
 
G

GeneHo

New member
VIP
Is there a script to draw horiz line of high / low of 1st bar (after market open), it can be in any time frame.
 

Top