Professional Documents
Culture Documents
1 of 4
User Name
Forums
Password
Register
Log in
Downloads / Indicators
Elite Members
Forgot
https://www.bigmiketrading.com/thinkorswim-programming/15544-help-...
Today's Posts
Wiki
Big Mike's Trading Forum > Trading Forums > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming
Views / Replies:
2,530 / 6
Last Reply:
Attachments:
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
#1 (permalink)
snipsta
Trading Apprentice
Tampa,Florida
Hello,
I am new to this forum and thinkscript but I am picking it up quick as I have prior programming experience. I'm trying to create a
basic strategy with the criteria shown below. I created the code off a modified version of the parabolicsarcrossover study so I am
confused why this is not working. No plot is being shown even though I can see this criteria occurring by manually looking at the
daily. My code to date is shown below each criteria. Any assistance is appreciated. Thank you
Long Entry (Daily chart, market hours)
----Parabolic SAR(.02,.2) becomes bullish
-MACD(12,26,9,EMA) crosses above 0
4/20/2014 11:08 PM
2 of 4
https://www.bigmiketrading.com/thinkorswim-programming/15544-help-...
Code
###########
declare LONG_ENTRY;
input opentime = 0930;
input closetime = 1600;
# Only enter during market hours:
#
def AP = getAggregationPeriod();
def daily = if AP >= aggregationPeriod.DAY then 1 else 0;
def isopen = if daily then 1 else if secondsFromTime(opentime) >= 0 and secondsTillTime(closetime) >= 0 then 1 else 0;
input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input crossingType = {default Bullish, Bearish};
def sar = ParabolicSAR(accelerationFactor=accelerationFactor, accelerationLimit=accelerationLimit);
def psarcrossover = if crosses(sar, close, CrossingType == CrossingType.Bullish) then 1 else 0;
def macdCrossover = if Crosses(MACDHistogram(12, 26, 9, "EMA"), 0, crossingdirection.above) then 1 else 0;
def total = psarcrossover + macdCrossover;
def trigger = if total == 2 then 1 else 0;
def price = close;
addOrder(trigger, price);
# Formatting:
#
SetColor(color.green);
Code
###########
declare LONG_EXIT;
input opentime = 0930;
input closetime = 1600;
# Only enter during market hours:
#
def AP = getAggregationPeriod();
def daily = if AP >= aggregationPeriod.DAY then 1 else 0;
def isopen = if daily then 1 else if secondsFromTime(opentime) >= 0 and secondsTillTime(closetime) >= 0 then 1 else 0;
input accelerationFactor = 0.02;
input accelerationLimit = 0.2;
input crossingType = {default Bearish, Bullish};
def sar = ParabolicSAR(accelerationFactor=accelerationFactor, accelerationLimit=accelerationLimit);
def psarcrossover = if crosses(sar, close, CrossingType == CrossingType.Bearish) then 1 else 0;
def macdCrossover = if Crosses(MACDHistogram(12, 26, 9, "EMA"), 0, crossingdirection.below) then 1 else 0;
def total = psarcrossover + macdCrossover;
def trigger = if total == 2 then 1 else 0;
def price = close;
addOrder(trigger, price);
# Formatting:
#
SetColor(color.red);
Cloudy
trade2winmils
desert CA
#2 (permalink)
Last I checked which was about a few months ago, strategies, while being able to be parsed in Thinkscript, still doesn't work on
TOS. The development resources seemed to have moved on to Prodigio.
4/20/2014 11:08 PM
3 of 4
https://www.bigmiketrading.com/thinkorswim-programming/15544-help-...
#3 (permalink)
snipsta
Trading Apprentice
Tampa,Florida
Trading Experience: Intermediate
Platform: ThinkorSwim
Favorite Instrument: Stocks/Options
Cloudy
Last I checked which was about a few months ago, strategies, while
being able to be parsed in Thinkscript, still doesn't work on TOS. The
development resources seemed to have moved on to Prodigio.
First off, thanks for the extremely quick reply. While I am new to TOS I have
created/modified some other very basic strategies and they seem to work fine. I
believe my problem is with the syntax of the parabolic sar as I have created
strategies with the MACD with no problems.
Cloudy
#4 (permalink)
Your welcome. Nice to hear strategies are working now, thanks. I may take a look sometime and try out what you posted.
trade2winmils
desert CA
Last edited by Cloudy; November 29th, 2011 at 06:09 AM.
Trading Experience: Beginner
Platform: NT7, ThinkOrSwim
Broker/Data: AMP/Commodity Quote
Graphics (CQG), TDAmeritrade
Favorite Instrument: CL, 6E, 6J, stock
options
abooter69
#5 (permalink)
Trading Apprentice
Las Vegas, nv
Trading Experience: Beginner
Platform: thinkorswim
Favorite Instrument: Free Money
RedK
Knowledge Seeker
Dubai, UAE
Trading Experience: Intermediate
Platform: TOS, TradeStation
Broker/Data: OX, TradeStation
Favorite Instrument: Stocks & Basic
Options
#6 (permalink)
#7 (permalink)
4/20/2014 11:08 PM
4 of 4
https://www.bigmiketrading.com/thinkorswim-programming/15544-help-...
Cloudy
trade2winmils
desert CA
Cloudy
Your welcome. Nice to hear strategies are working now, thanks. I may take a look sometime and try out what you
posted.
my post later
Top of Page
Tags
array, auto trade, basic, change, chart, close, code, color, create, daily, day, development, direction, ema, enter, entry, error, exit, format, function, limit, line, lot, macd, market,
market hours, open, parabolic, parabolic sar, period, platform, plot, price, prodigio, programming, sar, script, settings, strategies, strategy, syntax, tax, thank you, think or swim,
thinkorswim, thinkscript, time, tos, trade, variable
Big Mike's Trading Forum > Trading Forums > Platforms and Indicators > ThinkOrSwim > ThinkOrSwim Programming > Help with very basic ThinkScript Strategy
ATR percentage | Accessing current row value in volume profile?
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
ThinkScript studies
c0ol2
ThinkOrSwim
Curbfeeler
ThinkOrSwim Programming
StockJock
ThinkOrSwim Programming
tosmonkey
ThinkOrSwim Programming
All times are GMT -4. The time now is 12:03 AM.
Powered by vBulletin
Copyright 2000 - 2014, Jelsoft Enterprises Ltd.
SEO by vBSEO 2011, Crawlability, Inc.
Copyright 2014 by Big Mike Trading. 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.
Contact Us - Disclaimer, Terms of Use, and Terms and Conditions - Privacy Policy - Downloads - Top
Page generated 2014-04-21 in 0.26 seconds with 19 queries on phoenix via your IP 50.172.205.58
4/20/2014 11:08 PM