Buy and Sell Points Using Previous Days Open

TheRealBigFudge

New member
Hello - This is surely an easy fix, but I seem to be stuck. My buy and sell points are utilizing the previous days open price instead of the open price on the trade day.

Example would be the last Buy indicator is today (12/13). It indicates Buy To Open @3939.29, which is yesterday's (12/12) Open Price.

Curious as to what I am doing wrong to get the Price to the Open for current day vs previous.


lTXVb7Q.png


def triggerEnt = close[1] < close[2] ;

def TriggerExt = high[1] > high[2] ;

AddOrder(OrderType.BUY_TO_OPEN, triggerEnt, open, arrowcolor = (Color.GREEN), name = "Buy");

AddOrder(OrderType.SELL_TO_CLOSE, TriggerExt, open, arrowcolor = (Color.RED), name = "Sell");

Thank you in advance!
 
Last edited by a moderator:
Solution
Hello - This is surely an easy fix, but I seem to be stuck. My buy and sell points are utilizing the previous days open price instead of the open price on the trade day.

Example would be the last Buy indicator is today (12/13). It indicates Buy To Open @3939.29, which is yesterday's (12/12) Open Price.

Curious as to what I am doing wrong to get the Price to the Open for current day vs previous.


https%3A//i.imgur.com/lTXVb7Q.png[/img]']
lTXVb7Q.png


def triggerEnt = close[1] < close[2] ;

def TriggerExt = high[1] > high[2] ;

AddOrder(OrderType.BUY_TO_OPEN, triggerEnt, open, arrowcolor = (Color.GREEN), name = "Buy");

AddOrder(OrderType.SELL_TO_CLOSE, TriggerExt, open, arrowcolor = (Color.RED), name = "Sell");

Thank you in...
Hello - This is surely an easy fix, but I seem to be stuck. My buy and sell points are utilizing the previous days open price instead of the open price on the trade day.

Example would be the last Buy indicator is today (12/13). It indicates Buy To Open @3939.29, which is yesterday's (12/12) Open Price.

Curious as to what I am doing wrong to get the Price to the Open for current day vs previous.


https%3A//i.imgur.com/lTXVb7Q.png[/img]']
lTXVb7Q.png


def triggerEnt = close[1] < close[2] ;

def TriggerExt = high[1] > high[2] ;

AddOrder(OrderType.BUY_TO_OPEN, triggerEnt, open, arrowcolor = (Color.GREEN), name = "Buy");

AddOrder(OrderType.SELL_TO_CLOSE, TriggerExt, open, arrowcolor = (Color.RED), name = "Sell");

Thank you in advance!

Change the buy order to

AddOrder(OrderType.BUY_TO_OPEN, triggerEnt, open[-1], arrowcolor = (Color.GREEN), name = "Buy");
 
Solution

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

hello @SleepyZ @TheRealBigFudge .

thank you for your work so far

I would like to test something similiar to this but instead I want to reference yesterday's close.

So i want to capture a Gap Down Scenario where I sell

sell the close of yesterday(in the next day's session) i.e the opening gap has been filled and then cover the position
buying the next session open, given it opens lower than today's open.

e.g

Open the Trade
Sell 2/8 close when price crosses above it on 2/9

Close the Trade
On the open of 2/10 OR at a specified # of points profit say 40 Point on the ES


I tried experimenting with what you both wrote but it isn't showing me what i expect.

Code:
def triggerEnt = open[1] < close[-1] ;

def TriggerExt = low[1] < low[2] ;



AddOrder(OrderType.Sell_TO_OPEN, triggerEnt, open[-1], arrowcolor = (Color.GREEN), name = "Buy");

AddOrder(OrderType.BUY_TO_CLOSE, TriggerExt, open[-1], arrowcolor = (Color.RED), name = "Sell");

Thank you both or anyone who can chime in.
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
500 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