Strategy to exit trades on Friday for ThinkOrSwim

Gilgameash

New member
good tool to have, if you don't want to keep position open over the weekends. got tired of huge weekend losses.
WIP


Rich (BB code):
# close out every friday
input Plot_Is_It_Friday= yes;

input Plot_Is_It_Friday_Exit= yes;

# close on second to last bar on fridays
def timeFrame = GetAggregationPeriod();
def EOD = if timeFrame ==
AggregationPeriod.MIN and SecondsTillTime(1557) == 0 then 1 else if timeFrame ==
AggregationPeriod.TWO_MIN and SecondsTillTime(1554) == 0 then 1 else if timeFrame ==
AggregationPeriod.THREE_MIN and SecondsTillTime(1551) == 0 then 1 else if timeFrame ==
AggregationPeriod.FOUR_MIN and SecondsTillTime(1550) == 0 then 1 else if timeFrame ==
AggregationPeriod.FIVE_MIN and SecondsTillTime(1545) == 0 then 1 else if timeFrame ==
AggregationPeriod.TEN_MIN and SecondsTillTime(1530) == 0 then 1 else if timeFrame ==
AggregationPeriod.FIFTEEN_MIN and SecondsTillTime(1515) == 0 then 1 else if timeFrame ==
AggregationPeriod.TWENTY_MIN and SecondsTillTime(1510) == 0 then 1 else if timeFrame ==
AggregationPeriod.THIRTY_MIN and SecondsTillTime(1430) == 0  then 1 else 0;
def Exit_Time= EOD;


#is it friday?
def isFriday = GetDayOfWeek(GetYYYYMMDD()) == 5;
def allFridays = GetDayOfWeek(GetYYYYMMDD()[1]) == 5 ;


plot Friday_baby = if isFriday and Plot_Is_It_Friday then 1 else 0;
plot Friday_baby_Exit = if isFriday and Plot_Is_It_Friday_Exit and Exit_Time then 1 else 0;

Friday_baby.SetPaintingStrategy(paintingStrategy = PaintingStrategy.DASHES);

Friday_baby_Exit.SetPaintingStrategy(paintingStrategy = PaintingStrategy.BOOLEAN_ARROW_UP);
addOrder(OrderType.SELL_TO_CLOSE,Friday_baby_Exit, tickColor = Color.GREEN, arrowColor = Color.GREEN, name = "Friday Long Close");

AddOrder(type = OrderType.BUY_TO_CLOSE, condition = Friday_baby_Exit, arrowColor = Color.RED, name = "Friday Short Close", tickColor = Color.RED);
 

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
452 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