Scripting sell condition - ThinkOrSwim | futures trading

Go Back

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

Scripting sell condition
Started:June 22nd, 2015 (02:49 PM) by mtngoat Views / Replies:207 / 1
Last Reply:June 26th, 2015 (08:01 PM) 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

Scripting sell condition

Old June 22nd, 2015, 02:49 PM   #1 (permalink)
Trading Apprentice
Peachtree City, Georgia, USA
Futures Experience: Intermediate
Platform: TOS
Favorite Futures: Stocks
Posts: 1 since Jul 2014
Thanks: 0 given, 0 received

Scripting sell condition

I am new to think script. I am trying to script a strategy. I have been able to script the purchase conditions but there is something wrong with my sell condition which I have not been able to figure out. In words, I want to sell when the PercentR has crossed below 80 and when there is a close that is lower than the low of the day on which the PercentR crossed below 80, I want to sell on the next day open.

My script is as follows:

def test=reference PercentR(30,20,80);

def retestlo=if test crosses below 80 then low else retestlo;

AddOrder(OrderType.SELL_TO_CLOSE, retestlo>close, open[-1]);

Once the PercentR has crossed below 80, the low of that day stays in effect until the next time that the PercentR crosses below 80 (which can only happen if it has crossed above 80 in between).

Thanks for your help.

Reply With Quote

Old June 26th, 2015, 08:01 PM   #2 (permalink)
Trading Apprentice
Boston + Massachusetts/United States
Futures Experience: Beginner
Platform: ThinkorSwim
Favorite Futures: Futures
mroland19's Avatar
Posts: 5 since May 2015
Thanks: 15 given, 1 received

Scripting sell condition

I am new to think script.

Will Ameritrade give you technical service help even for a cost? Maybe they have think scrip help center. If I find any material that might help I'll send it your way. Good luck.

Last edited by mroland19; June 26th, 2015 at 08:02 PM. Reason: wanted to keep the titles the same as op
Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > ThinkOrSwim > Scripting sell condition

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
Scripting TWS on a Mac fritzybloch IB Trader Workstation 1 May 26th, 2016 10:56 AM
Basic scripting question for study filter Hockster ThinkOrSwim Programming 4 September 4th, 2014 07:32 AM
Need some help for c sharp scripting hugebaozi NinjaTrader Programming 1 July 9th, 2014 10:06 PM
Does TWS Offer Built-In Scripting? TraitorX IB Trader Workstation 0 January 11th, 2014 11:50 PM
link an exit condition to a particular entry condition vegtrip ThinkOrSwim 0 October 12th, 2013 08:49 AM

All times are GMT -4. The time now is 11:01 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-27 in 0.07 seconds with 19 queries on phoenix via your IP