Atttempting to convert Tradestation ELS into Thinkscript... - ThinkOrSwim | futures io social day trading
futures io futures trading


Atttempting to convert Tradestation ELS into Thinkscript...
Updated: Views / Replies:62 / 2
Created: by netarchitech Attachments:0

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 100,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
 

Atttempting to convert Tradestation ELS into Thinkscript...

  #1 (permalink)
Trading for Fun
NY, NY
 
Trading Experience: Intermediate
Platform: TOS
Favorite Futures: Stocks, ETFs
 
Posts: 56 since Dec 2011
Thanks: 20 given, 13 received

Atttempting to convert Tradestation ELS into Thinkscript...

I'm trying to convert a Tradestation ELS into Thinkscript. Here is the Tradestation code:

 
Code
inputs:
Length(20);

vars:
srsi(0),
srsin(0),
k(0);

srsin = 0;
For k = 0 to Length - 1
Begin
Value1 = absvalue(close[k] - open[k];
Value2 = absvalue(high[k] - low[k];
If value2 = 0 then value3 = 0
Else
Value3 = value1/value2;
srsin = srsin + value3;
End;

srsi = srsin/length;

plot1(0.38);
plot2(srsi);
plot3(-0.38);
plot4(0);
If srsi > 0 then Setplotcolor(2,green);
If srsi < 0 then Setplotcolor(2,red);
If srsi >= -0.05 and srsi <= 0.05 then Setplotcolor(2,yellow);

Setplotcolor(1,darkred);
Setplotcolor(3,darkgreen);
Setplotcolor(4,yellow);

Here is my attempt at converting it to Thinkscript:

 
Code
declare lower;

input Length = 20;

def srsi = 0;
def srsin = 0;
def k = 0;

plot iteration = fold k = 0 to Length - 1;

def Value1 = absvalue(close[k] - open[k]);
def Value2 = absvalue(high[k] - low[k]);
def Value = if value2 == 0 then value3 == 0 else value3 == value1 / value2;

def srsin = srsin + value3;

def srsi = srsin / Length;

plot line1 = 0.38;
line1.SetDefaultColor(Color.DARK_RED);
line1.HideTitle();
line1.HideBubble();

plot line2 = srsi;
line2.AssignValueColor(if srsi > 0 then Color.GREEN 
else if srsi < 0 then Color.RED 
else if srsi >= -0.05 and srsi <= 0.05 then Color.YELLOW 
else Color.GRAY);
line2.SetLineWeight(2);
line2.HideTitle();

plot line3 = -0.38;
line3.SetDefaultColor(Color.DARK_GREEN);
line3.HideTitle();
line3.HideBubble();

plot ZeroLine = 0;
ZeroLine.SetDefaultColor(Color.ORANGE);
ZeroLine.HideTitle();
ZeroLine.HideBubble();
The Thinkscript compiler says the fold statement is invalid. This is the first time I've attempted to work with a fold statement.

Any assistance would be greatly appreciated. Thanks in advance...

Reply With Quote
 
  #2 (permalink)
Elite Member
Boston MA USA
 
Trading Experience: Beginner
Platform: None
Favorite Futures: ES, Stocks, ETFs
 
Posts: 35 since Jan 2015
Thanks: 26 given, 33 received

I briefly looked at the online reference for 'fold'. Two possibilities:

1) In fold, a 'do' keyword is not optional...your code is missing it however.
2) You've got the variable k being defined before the fold, it may not need to be? A def in thinkscript means a variable that holds a value for each bar, like a plot but with no visualization. So, that's completely different from a loop counter. Try deleting that line if it still complains.

Reply With Quote
 
  #3 (permalink)
Trading for Fun
NY, NY
 
Trading Experience: Intermediate
Platform: TOS
Favorite Futures: Stocks, ETFs
 
Posts: 56 since Dec 2011
Thanks: 20 given, 13 received



ocpb View Post
I briefly looked at the online reference for 'fold'. Two possibilities:

1) In fold, a 'do' keyword is not optional...your code is missing it however.
2) You've got the variable k being defined before the fold, it may not need to be? A def in thinkscript means a variable that holds a value for each bar, like a plot but with no visualization. So, that's completely different from a loop counter. Try deleting that line if it still complains.

@ocpb,

Thanks for the reply and the insights. I really appreciate it

Reply With Quote

Reply



futures io > > > > Atttempting to convert Tradestation ELS into Thinkscript...

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Journal Challenge $1600 in Prizes & Free Journalytix for all participants!

February
 

3 Excellent Entries, and How To Automate Them w/Kevin Davey

Feb 21
 

The Driving Force Behind the Market w/Earn2Trade

Mar 5
 

TBA w/Stage5 & iSystems

Mar 12
 

TBA w/John Grady @ No BS Day Trading

Mar 19
 

Day Trading Oil Futures: Reducing Risk & Increasing Profits w/DTN IQFeed

Mar 26
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Pinescript into Thinkscript... netarchitech ThinkOrSwim 0 May 24th, 2018 06:09 PM
Convert ThinkScript to ThinkScript API t0757tlr ThinkOrSwim Programming 0 May 20th, 2018 12:09 PM
Convert Easy Language code into Thinkscript sboarder13 ThinkOrSwim 20 November 22nd, 2016 01:47 AM
Need a programmer to convert ninjascript into tradestation stefp799 Hire a Consultant or Programmer 0 July 28th, 2015 12:39 PM
Convert Easy Language code into Thinkscript study ckajrtx ThinkOrSwim 0 May 10th, 2014 02:07 AM


Tags
code, thinkorswim, thinkscript, tos, tradestation, variable

All times are GMT -4. The time now is 07:01 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, 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 2019-02-19 in 0.16 seconds with 13 queries on phoenix