Finding the high and low of a candle which includes the wick.

ksadras

New member
Hi I am printing the High and Low of the first candle when the market open. I am not getting the right values. Can you please let me know what I am doing wrong..

See the picture at
Sl40YAS.png



input rangeHighPrice = high;
input rangeLowPrice = low;


def rg = AbsValue(rangeHighPrice - rangeLowPrice);

plot range = rg;
range.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

range.SetDefaultColor(Color.DARK_GREEN);

def NineThirty = SecondsFromTime(930) > 0;
def TwelveOclock = SecondsFromTime(1200) > 0;
def MarketOpen = NineThirty > 0 && NineThirty [1] <= 0;
def LunchTime = TwelveOclock > 0 && TwelveOclock[1] <= 0;


AddVerticalLine(MarketOpen,if MarketOpen then “High:” + high +" Low:" + low else "",if MarketOpen then color.GREEN else color.BLUE);
 
Hi I am printing the High and Low of the first candle when the market open. I am not getting the right values. Can you please let me know what I am doing wrong..

See the picture at
Sl40YAS.png



input rangeHighPrice = high;
input rangeLowPrice = low;


def rg = AbsValue(rangeHighPrice - rangeLowPrice);

plot range = rg;
range.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

range.SetDefaultColor(Color.DARK_GREEN);

def NineThirty = SecondsFromTime(930) > 0;
def TwelveOclock = SecondsFromTime(1200) > 0;
def MarketOpen = NineThirty > 0 && NineThirty [1] <= 0;
def LunchTime = TwelveOclock > 0 && TwelveOclock[1] <= 0;


AddVerticalLine(MarketOpen,if MarketOpen then “High:” + high +" Low:" + low else "",if MarketOpen then color.GREEN else color.BLUE);

Try changing these:

Ruby:
def NineThirty = SecondsFromTime(930) == 0;
def TwelveOclock = SecondsFromTime(1200) == 0;
 
Thanks. That didn't work. The bar above which shows the high and lows seem to correctly show for every bar. I tried changing to 930.05, 931 and 930.59 and all return different results but dont match what the actual candle high and lows are.
The code change to your code works for me. Are you wanting something different than just a vertical line at the first bar with the high/low of that bar?

Ruby:
input rangeHighPrice = high;
input rangeLowPrice = low;


def rg = AbsValue(rangeHighPrice - rangeLowPrice);

plot range = rg;
range.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

range.SetDefaultColor(Color.DARK_GREEN);

def NineThirty = SecondsFromTime(930) == 0;
def TwelveOclock = SecondsFromTime(1200) == 0;
def MarketOpen = NineThirty > 0 && NineThirty [1] <= 0;
def LunchTime = TwelveOclock > 0 && TwelveOclock[1] <= 0;


AddVerticalLine(MarketOpen,if MarketOpen then “High:” + high +" Low:" + low else "",if MarketOpen then color.GREEN else color.BLUE);
 
I am just trying to capture the high and low value of the first market candle bar. May I ask what change in the code that worked? Thanks a lot.
It was just changing the 2 lines in your code with what I posted. Here is the code with those revisions, plus a chart bubble that displays the same information that is in the vertical line

Capture.jpg
Ruby:
input rangeHighPrice = high;
input rangeLowPrice = low;


def rg = AbsValue(rangeHighPrice - rangeLowPrice);

plot range = rg;
range.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

range.SetDefaultColor(Color.DARK_GREEN);

def NineThirty = SecondsFromTime(930) == 0;
def TwelveOclock = SecondsFromTime(1200) == 0;
def MarketOpen = NineThirty > 0 && NineThirty [1] <= 0;
def LunchTime = TwelveOclock > 0 && TwelveOclock[1] <= 0;


AddVerticalLine(MarketOpen, if MarketOpen then “High:” + high + " Low:" + low else "", if MarketOpen then Color.GREEN else Color.BLUE);

addchartBubble(marketopen, high, “High:” + high + " \nLow:" + low,if MarketOpen then color.GREEN else color.BLUE);
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
385 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top