Need Help cleaning up a Thinkscript - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


Need Help cleaning up a Thinkscript
Updated: Views / Replies:1,280 / 5
Created: by esc952 Attachments:2

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • 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.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Need Help cleaning up a Thinkscript

  #1 (permalink)
Trading Apprentice
mansfield oh/usa
 
Futures Experience: Advanced
Platform: tradestation
Favorite Futures: stocks
 
Posts: 4 since Jan 2015
Thanks: 2 given, 0 received

Need Help cleaning up a Thinkscript

Folks,
I apologize in advance if I'm stepping over any lines, but I need a hand and don't have the right tools to do what I want to accomplish. The long and short of it is my Dad asked me to write a TOS scan script for him. All well and fine except he's 1000 miles away and I don't use TOS. I won't say no to him, but I hate the idea of having to open/fund a TOS account to test one freakin scan.

The basic idea is to look for a pullback after a breakout above a specific very narrow Boll Band. The breakout has to have closed above the Top Boll Band at least 5 times and the last 5 of those have to include the pullback.

Anyway, I got the scan written in 2 other platforms to verify the results match and are what he wants. Then I tried to do the translation to TOS. I've written a script and believe the logic is sound. However, my coding of the logic lost something in TOS translation.

Anyone see where I went awry? He tells me the error highlights everything after the first Plot statement (first post-define statement) but gives a typical programming error message. (Might as well say "It don't work...try again!")

Here's the code:

def O = open;
def C = close;
def H = high;
def L = low;
def AVGC50 = Average(close, 50);
def AvgC20 = Average(close, 20);
def MyStDev = 0.382 * StDev(close, 20);
def TopBB = AvgC20 + MyStDev;
def TopBB1 = AvgC20[1] + MyStDev[1];
def TopBB2 = AvgC20[2] + MyStDev[2];
def TopBB3 = AvgC20[3] + MyStDev[3];
def TopBB4 = AvgC20[4] + MyStDev[4];
def MINL7 = Lowest(low, 7);
def MINL8 = Lowest(low, 8);
def MINL9 = Lowest(low, 9);
def MINL10 = Lowest(low, 10);
def MAXH5 = Highest(high, 5);
def MAXH8 = Highest(high, 8);

Plot ThreeAScan = (
C > AVGC50 and
C > TopBB and
C[1] > TopBB1 and
C[2] > TopBB2 and
C[3] > TopBB3 and
C[4] > TopBB4 and
((H < H[1] and H[1] > H[2] AND H[2] > H[3] AND H[3] > H[4]) OR
(H < H[1] and H[1] < H[2] AND H[2] > H[3] AND H[3] > H[4]) OR
(H < H[1] and H[1] < H[2] AND H[2] < H[3] AND H[3] > H[4]) OR
(H < H[1] and H[1] < H[2] AND H[2] < H[3] AND H[3] < H[4])) and
((L[5] = MINL7) OR
(L[6] = MINL8) OR
(L[7] = MINL9) OR
(L[8] = MINL10))
);

Plot ThreeAEntry = (MAXH5 + 0.01);
Plot ThreeAStop = (MINL8 - 0.02);
Plot ThreeATarget = ((MAXH8 - MINL8) + MAXH8);
Plot ThreeAFarTarget = ( (2 * (MAXH8 - MINL8)) + MAXH8 );


Thanks in advance and all suggestions are greatly appreciated.

Reply With Quote
 
  #2 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
 
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ES
 
rmejia's Avatar
 
Posts: 384 since Oct 2010
Thanks: 3,597 given, 421 received

The problem is in this part:
((L[5] = MINL7) OR
(L[6] = MINL8) OR
(L[7] = MINL9) OR
(L[8] = MINL10))

the = gives an error. Can it be > or < instead ? or >= ?
(l[5] >= minl7)
(l[5] > minl7)

Reply With Quote
The following user says Thank You to rmejia for this post:
 
  #3 (permalink)
Trading Apprentice
mansfield oh/usa
 
Futures Experience: Advanced
Platform: tradestation
Favorite Futures: stocks
 
Posts: 4 since Jan 2015
Thanks: 2 given, 0 received


I'll have to think on it...but thanks for pointing me straight. I'll change if it doesn't screw up the logic, send it to my Dad and let him run it up the flagpole to see who salutes.

Thanks again. I'll let you know how it goes.

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
mansfield oh/usa
 
Futures Experience: Advanced
Platform: tradestation
Favorite Futures: stocks
 
Posts: 4 since Jan 2015
Thanks: 2 given, 0 received

Well, that at least changed the error message. I simplified it a little bit to help figure things out. However, it now doesn't seem to recognize one of my "define" statements.

Simplified code:

def O = open;
def C = close;
def H = high;
def L = low;
def AVGC50 = Average(close, 50);
def AvgC20 = Average(close, 20);
def MyStDev = 0.382 * StDev(close, 20);
def TopBB = AvgC20 + MyStDev;
def TopBB1 = AvgC20[1] + MyStDev[1];
def TopBB2 = AvgC20[2] + MyStDev[2];
def TopBB3 = AvgC20[3] + MyStDev[3];
def TopBB4 = AvgC20[4] + MyStDev[4];
def MINL7 = Lowest(low, 7);
def MINL8 = Lowest(low, 8);
def MINL9 = Lowest(low, 9);
def MINL10 = Lowest(low, 10);
def MAXH5 = Highest(high, 5);
def MAXH8 = Highest(high, 8);

Plot ThreeAScan = (

C > AVGC50 and
C > TopBB and
C[1] > TopBB1 and
C[2] > TopBB2 and
C[3] > TopBB3 and
C[4] > TopBB4 and
((H < H[1] and H[1] > H[2] AND H[2] > H[3] AND H[3] > H[4]) OR
(H < H[1] and H[1] < H[2] AND H[2] > H[3] AND H[3] > H[4]) OR
(H < H[1] and H[1] < H[2] AND H[2] < H[3] AND H[3] > H[4]) OR
(H < H[1] and H[1] < H[2] AND H[2] < H[3] AND H[3] < H[4])) and
((L[5] <= MINL7) OR
(L[6] <= MINL8) OR
(L[7] <= MINL9) OR
(L[8] <= MINL10))
);

Error now generated:

Expected double
No such variable: C at 20:1
No such variable: C at 21:1
No such variable: C at 22:1
No such variable: C at 23:1
No such variable: C at 24:1
No such variable: C at 25:1
No such variable: C at 20:1
No such variable: C at 21:1
No such variable: C at 22:1
No such variable: C at 23:1
No such variable: C at 24:1
No such variable: C at 25:1

Any ideas why it doesn't recognize the "def C = close;" statement ?

Reply With Quote
 
  #5 (permalink)
1.Fibs 2.??? 3.Profit
Puerto Rico
 
Futures Experience: Intermediate
Platform: thinkorswim
Broker/Data: TD Ameritrade
Favorite Futures: ES
 
rmejia's Avatar
 
Posts: 384 since Oct 2010
Thanks: 3,597 given, 421 received

I tried it and got no error, attached images.

Attached Thumbnails
Need Help cleaning up a Thinkscript-scan.png   Need Help cleaning up a Thinkscript-scan1.png  
Reply With Quote
The following user says Thank You to rmejia for this post:
 
  #6 (permalink)
Trading Apprentice
mansfield oh/usa
 
Futures Experience: Advanced
Platform: tradestation
Favorite Futures: stocks
 
Posts: 4 since Jan 2015
Thanks: 2 given, 0 received

Man I really appreciate it. Good to know.

I guess I need to have my dad try it again. (At 80 he's not uber-computer savvy, but he does pick it up quick when shown.)

Again...many thanks!

Reply With Quote

Reply



futures io > > > > > Need Help cleaning up a Thinkscript

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
thinkscript purelife173 ThinkOrSwim Programming 0 October 31st, 2014 12:50 AM
thinkscript reference situhold ThinkOrSwim 3 September 12th, 2014 01:58 PM
Possible study with ThinkScript? TonyB ThinkOrSwim 0 March 4th, 2012 11:27 PM
Investor Spring Cleaning: How to Manage a 'Death Portfolio' Quick Summary News and Current Events 0 May 27th, 2010 09:40 PM
Investor Spring Cleaning: Does Diversifying Really Still Work? Quick Summary News and Current Events 0 May 24th, 2010 05:00 PM


All times are GMT -4. The time now is 02:29 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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 2017-12-17 in 0.11 seconds with 20 queries on phoenix via your IP 54.82.56.95