AstroBoy
New member
Hey everyone!
As I'm starting to learn ThinkScript, I wanted to make a basic script.
GOAL: The script will plot a price level line indicating the Market OPEN price... The plot will start from the end of the first market hour 10:30 AM EST and extend to the left towards first candle at 9:30 AM EST OR the plot will start from the 9:30 AM Market Open Price candle, and extend towards the 10:30 AM EST vertical line.
I took inspiration from a user here named Markos that helped others with defining a specific candle on the chart, but my plot is invalid. Can someone help me?
Here's a PhotoShopped example of what I am trying to accomplish as an illustration
As I'm starting to learn ThinkScript, I wanted to make a basic script.
GOAL: The script will plot a price level line indicating the Market OPEN price... The plot will start from the end of the first market hour 10:30 AM EST and extend to the left towards first candle at 9:30 AM EST OR the plot will start from the 9:30 AM Market Open Price candle, and extend towards the 10:30 AM EST vertical line.
I took inspiration from a user here named Markos that helped others with defining a specific candle on the chart, but my plot is invalid. Can someone help me?
Code:
#This will draw a vertical line indicating the end of the first hour of trading
AddVerticalLine(SecondsTillTime(1030) == 0, “First Hour”, Color.GRAY, PaintingStrategy.horizontal);
#This defines the exact candle at 9:30 AM EST market open
def na = double.nan;
def MarketOpenCandle = if SecondsFromTime (0930) == 0 && SecondsTillTime(0930) == 0
then barNumber()
else na;
#This defines the Market OPEN price to then place the chart bubble
Def MarketOpenPrice = if barNumber() == MarketOpenCandle
then OPEN
else MarketOpenPrice[1];
addchartbubble(MarketOpenPrice,OPEN,”Market Open Price”);
#This plot is INVALID and doesn't work
Plot Opening_Price = MarketOpenPrice
Here's a PhotoShopped example of what I am trying to accomplish as an illustration