Close position 10 days after it was opened - ThinkOrSwim Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming

Close position 10 days after it was opened
Started:September 20th, 2013 (09:47 AM) by skorpyo Views / Replies:675 / 1
Last Reply:September 20th, 2013 (10:55 AM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community. It's free and simple, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Close position 10 days after it was opened

Old September 20th, 2013, 09:47 AM   #1 (permalink)
Trading Apprentice
Bucharest + Romania
Futures Experience: Advanced
Platform: Thinkorswim, NinjaTrader, Metatrader
Favorite Futures: Options, Forex
Posts: 2 since Jul 2013
Thanks: 0 given, 0 received

Close position 10 days after it was opened

Hello everyone.

I am new to thinkscript. I am researching something and have created a strategy about buying into weakness.

I am having trouble with my sell to close order.

AddOrder(OrderType.SELL_AUTO, close>close[10], close, 100, Color.WHITE, Color.WHITE, "Close @ " + close);
I would like to close the position in the strategy 10 days after it was opened. The code above just takes the current close and compares it to the last 10 days which does not help me.

Could you guys please lend me a hand?


Reply With Quote

Old September 20th, 2013, 10:55 AM   #2 (permalink)
Trading Apprentice
Buenos Aires, Argentina
Futures Experience: Intermediate
Platform: NinjaTrader, TOS
Favorite Futures: ES
Posts: 47 since Jun 2013
Thanks: 39 given, 4 received

Not sure, but I think getDay() will help

GetDay ? Resource Center

HTML Code:
plot Price = if GetDay() <= 100 then close else Double.NaN;

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming > Close position 10 days after it was opened

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Indicator: Add to opened position ivanjocic NinjaTrader 39 July 21st, 2015 11:24 AM
Ninja Close Position / Close Button / ChartTrader vantojo NinjaTrader Programming 1 October 15th, 2012 05:51 PM
Apple's Once-Invincible Stock Skids Over 10% in Just 10 Days Quick Summary News and Current Events 2 April 21st, 2012 10:52 AM
Using TWS, What is the easiest way to close a forex position arjfca IB Trader Workstation 3 April 20th, 2012 08:58 AM
Close position based on day of week guppy EasyLanguage Programming 3 October 21st, 2011 03:31 PM

All times are GMT -4. The time now is 03:43 AM.

Copyright © 2016 by All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts

Page generated 2016-10-26 in 0.06 seconds with 20 queries on phoenix via your IP