Converting EasyLanguage Code to Thinkscript Code (TOS) - ThinkOrSwim | futures io | futures trading
futures io futures trading


Converting EasyLanguage Code to Thinkscript Code (TOS)
Updated: Views / Replies:1,060 / 2
Created: by joeking 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

 
 
Thread Tools
 

Converting EasyLanguage Code to Thinkscript Code (TOS)

 
breman Germany
 
 
Posts: 7 since Nov 2017
Thanks: 1 given, 1 received

Converting EasyLanguage Code to Thinkscript Code (TOS)

Is there anyone out there that can help me convert EasyLanguage code into a Thinkscript code?

I think this indicator can help a lot with my trading...the version I have now in TOS doesn't seem to have the right colors that the original code has.

If anyone out there can take a crack at it or point me to some sort of converter program, that would be ver helpful...here is the code -

Better Volume Indicator - EasyLanguage - Version 19 August 2012

Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True), ClimaxChurn(False), LowVolColor(Yellow), ClimaxUpColor(Red), ClimaxDownColor(White), ChurnColor(Green), ClimaxChurnColor(Magenta), Color(Cyan), UseUpTicks(True), Use2Bars(True), ShowAvg(False), AvgColor(Red);
Variables: BarColor(Cyan), Lookback(20);

BarColor = Color;

If BarType > 1 then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+O-C))*V;
If C < O and Range <> 0 then Value1 = ((Range+C-O)/(2*Range+C-O))*V;
If C = O then Value1 = 0.5*V;
Value2 = V-Value1;
End;
If BarType <= 1 and UseUpTicks = False then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+O-C))*Ticks;
If C < O and Range <> 0 then Value1 = ((Range+C-O)/(2*Range+C-O))*Ticks;
If C = O then Value1 = 0.5*Ticks;
Value2 = Ticks-Value1;
End;
If BarType <= 1 and UseUpTicks then begin
Value1 = UpTicks;
Value2 = DownTicks;
End;

Value3 = AbsValue(Value1+Value2);
Value4 = Value1*Range;
Value5 = (Value1-Value2)*Range;
Value6 = Value2*Range;
Value7 = (Value2-Value1)*Range;
If Range <> 0 then begin
Value8 = Value1/Range;
Value9 = (Value1-Value2)/Range;
Value10 = Value2/Range;
Value11 = (Value2-Value1)/Range;
Value12 = Value3/Range;
End;
If Use2Bars then begin
Value13 = Value3+Value3[1];
Value14 = (Value1+Value1[1])*(Highest(H,2)-Lowest(L,2));
Value15 = (Value1+Value1[1]-Value2-Value2[1])*(Highest(H,2)-Lowest(L,2));
Value16 = (Value2+Value2[1])*(Highest(H,2)-Lowest(L,2));
Value17 = (Value2+Value2[1]-Value1-Value1[1])*(Highest(H,2)-Lowest(L,2));
If Highest(H,2) <> Lowest(L,2) then begin
Value18 = (Value1+Value1[1])/(Highest(H,2)-Lowest(L,2));
Value19 = (Value1+Value1[1]-Value2-Value2[1])/(Highest(H,2)-Lowest(L,2));
Value20 = (Value2+Value2[1])/(Highest(H,2)-Lowest(L,2));
Value21 = (Value2+Value2[1]-Value1-Value1[1])/(Highest(H,2)-Lowest(L,2));
Value22 = Value13/(Highest(H,2)-Lowest(L,2));
End;
End;

Condition1 = Value3 = Lowest(Value3,Lookback);
Condition2 = Value4 = Highest(Value4,Lookback) and C > O;
Condition3 = Value5 = Highest(Value5,Lookback) and C > O;
Condition4 = Value6 = Highest(Value6,Lookback) and C < O;
Condition5 = Value7 = Highest(Value7,Lookback) and C < O;
Condition6 = Value8 = Lowest(Value8,Lookback) and C < O;
Condition7 = Value9 = Lowest(Value9,Lookback) and C < O;
Condition8 = Value10 = Lowest(Value10,Lookback) and C > O;
Condition9 = Value11 = Lowest(Value11,Lookback) and C > O;
Condition10 = Value12 = Highest(Value12,Lookback);
If Use2Bars then begin
Condition11 = Value13 = Lowest(Value13,Lookback);
Condition12 = Value14 = Highest(Value14,Lookback) and C > O and C[1] > O[1];
Condition13 = Value15 = Highest(Value15,Lookback) and C > O and C[1] > O[1];
Condition14 = Value16 = Highest(Value16,Lookback) and C < O and C[1] < O[1];
Condition15 = Value17 = Highest(Value17,Lookback) and C < O and C[1] < O[1];
Condition16 = Value18 = Lowest(Value18,Lookback) and C < O and C[1] < O[1];
Condition17 = Value19 = Lowest(Value19,Lookback) and C < O and C[1] < O[1];
Condition18 = Value20 = Lowest(Value20,Lookback) and C > O and C[1] > O[1];
Condition19 = Value21 = Lowest(Value21,Lookback) and C > O and C[1] > O[1];
Condition20 = Value22 = Highest(Value22,Lookback);
End;

If BarType > 1 then begin
If LowVol and (Condition1 or Condition11) then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or Condition12 or Condition13 or Condition18 or Condition19) then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7 or Condition14 or Condition15 or Condition16 or Condition17) then BarColor = ClimaxDownColor;
If Churn and (Condition10 or Condition20) then BarColor = ChurnColor;
If ClimaxChurn and (Condition10 or Condition20) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or
Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) then BarColor = ClimaxChurnColor;
End;

If BarType <= 1 then begin
If LowVol and (Condition1 or (Condition11 and D=D[1])) then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or ((Condition12 or Condition13 or Condition18 or Condition19) and D=D[1])) then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7 or ((Condition14 or Condition15 or Condition16 or Condition17) and D=D[1])) then BarColor = ClimaxDownColor;
If Churn and (Condition10 or (Condition20 and D=D[1])) then BarColor = ChurnColor;
If ClimaxChurn and (Condition10 or (Condition20 and D=D[1])) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or
((Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) and D=D[1])) then BarColor = ClimaxChurnColor;
End;

Plot1(Value3,"Volume",BarColor);
If ShowAvg then Plot2(Average(Value3,200),"Avg",AvgColor);

{ Change Log: }
{23 November 2007 - Added LowChurn colored volume bars }
{19 April 2008 - Got rid of LowChurn and replaced with ClimaxDown }
{19 April 2008 - Added open & close conditions with ClimaxUp and ClimaxDown }
{19 April 2008 - Added different calculations for tick/intra-day charts }
{26 June 2008 - Added ability to turn average volume line on and off }
{5 July 2008 - Changed Lookback from a variable to an input }
{13 July 2008 - Added 2 bar climax, churn and low volume conditions }
{4 September 2008 - Changed daily bars calculation to match tick/intra-day }
{25 January 2009 - Added condition total volume (Value3) could not be -ve }
{19 August 2012 - Changed calculation for Intra-day + UseUpTicks = False }

 
 
Merida, Yucatan, Mexico
 
 
Posts: 103 since Nov 2010
Thanks: 14 given, 57 received

I think it would be easier to modify the existing TOS script so it looks the way you want.


Sent from my iPad using futures.io

The following user says Thank You to bradhouser for this post:
 
 
breman Germany
 
 
Posts: 7 since Nov 2017
Thanks: 1 given, 1 received

Thanks


I would love to modify, but having a hard time figuring out how to change the colors in Thinkscript...the colors in the original emini-watch indicator are different then the ones here...PLUS I think they ...colors are coded by numbers....tried to change the numbers around, but didn't show up on the final chart.....check it out if you can...any help would be very much appreciated -

#
# TS_BetterVolume_Indicator
#
# A better volume indicator with color coded histogram plot that
# shows 4 different colors depending on price action and volume
#
# Yellow - Low volume for the size of the bar - Amateurs at work
# White - Climax down
# Blue -Climax up
# Red - Churn - Pros buying at lows or unloading at highs
# Magenta - Climax Churn - Pros taking profits at highs or lows
# Gray - Normal (default) Bar
#
declare lower;
#
input lookback = 8;
input Use2Bars = {"No", default "Yes"};
input LowVol = {"No",default "Yes"};
input ClimaxUp = {"No",default "Yes"};
input ClimaxDown = {"No",default "Yes"};
input Churn = {"No",default "Yes"};
input ClimaxChurn = {"No",default "Yes"};

def LowVolColor = 8;
def ClimaxUpColor = 9;
def ClimaxDownColor = 1;
def ChurnColor = 5;
def ClimaxChurnColor = 0;
def DefaultBarColor = 7;
def AvgColor = 0;

def Range = TrueRange(high,low,close);
def Value1 = if (close >= open,Volume * ((Range) / ((2+(Range*Range)/10) * Range + (open - close))),
Volume * (((Range + close - open)) / (2+(Range*Range)/10) * Range + (close - open)));
def Value2 = Volume - Value1;

def Value3 = Value1 + Value2;
def Value4 = Value1 * Range;
def Value5 = (Value1 - Value2) * Range;
def Value6 = Value2 * Range;
def Value7 = (Value2 - Value1) * Range;
def Value8 = if (Range <> 0, Value1 / Range, 1);
def Value9 = if (Range <> 0, (Value1 - Value2) / Range, 1);
def Value10 = if (Range <> 0, Value2 / Range, 1);
def Value11 = if (Range <> 0, (Value2 - Value1) / Range, 1);
def Value12 = if (Range <> 0, Value3 / Range, 1);
def Value13 = if (Use2Bars, Value3 + Value3[1],1);
def Value14 = if (Use2Bars, (Value1 + Value1[1])*(Highest(High,2)-Lowest(Low,2)),1);
def Value15 = if (Use2Bars, (Value1 + Value1[1]-Value2-Value2[1])*(Highest(High,2)-Lowest(Low,2)),1);
def Value16 = if (Use2Bars, (Value2 + Value2[1])*(Highest(High,2)-Lowest(Low,2)),1);
def Value17 = if (Use2Bars, (Value2 + Value2[1]-Value1-Value1[1])*(Highest(High,2)-Lowest(Low,2)),1);
def Value18 = if ((Use2Bars and (Highest(High,2)<>Lowest(Low,2))),(Value1+Value1[1])/(Highest(High,2)-Lowest(Low,2)),1);
def Value19 = if ((Use2Bars and (Highest(High,2)<>Lowest(Low,2))),(Value1+Value1[1]-Value2-Value2[1])/(Highest(High,2)-Lowest(Low,2)),1);
def Value20 = if ((Use2Bars and (Highest(High,2)<>Lowest(Low,2))),(Value2+Value2[1])/(Highest(High,2)-Lowest(Low,2)),1);
def Value21 = if ((Use2Bars and (Highest(High,2)<>Lowest(Low,2))),(Value2+Value2[1]-Value1-Value1[1])/(Highest(High,2)-Lowest(Low,2)),1);
def Value22 = if ((Use2Bars and (Highest(High,2)<>Lowest(Low,2))),Value13/(Highest(High,2)-Lowest(Low,2)),1);


def Condition1 = if(Value3 == Lowest(Value3, Lookback), 1, 0);
def Condition2 = if((Value4 == Highest(Value4, Lookback) and close > open), 1, 0);
def Condition3 = if((Value5 == Highest(Value5, Lookback) and close > open), 1, 0);
def Condition4 = if((Value6 == Highest(Value6, Lookback) and close < open), 1, 0);
def Condition5 = if((Value7 == Highest(Value7, Lookback) and close < open), 1, 0);
def Condition6 = if((Value8 == Lowest(Value8, Lookback) and close < open), 1, 0);
def Condition7 = if((Value9 == Lowest(Value9, Lookback) and close < open), 1, 0);
def Condition8 = if((Value10 == Lowest(Value10, Lookback) and close > open), 1, 0);
def Condition9 = if((Value11 == Lowest(Value11, Lookback) and close > open), 1, 0);
def Condition10 = if(Value12 == Highest(Value12, lookback), 1, 0);
def Condition11 = if (Use2Bars and (Value13==Lowest(Value13,Lookback) and close > open and Close[1] > Open[1]),1,0);
def Condition12 = if (Use2Bars and (Value14==Highest(Value14,Lookback) and close > open and Close[1] > Open[1]),1,0);
def Condition13 = if (Use2Bars and (Value15==Highest(Value15,Lookback) and close > open and Close[1] < Open[1]),1,0);
def Condition14 = if (Use2Bars and (Value16==Lowest(Value16,Lookback) and close < open and Close[1] < Open[1]),1,0);
def Condition15 = if (Use2Bars and (Value17==Lowest(Value17,Lookback) and close < open and Close[1] < Open[1]),1,0);
def Condition16 = if (Use2Bars and (Value18==Lowest(Value18,Lookback) and close < open and Close[1] < Open[1]),1,0);
def Condition17 = if (Use2Bars and (Value19==Lowest(Value19,Lookback) and close > open and Close[1] < Open[1]),1,0);
def Condition18 = if (Use2Bars and (Value20==Lowest(Value20,Lookback) and close > open and Close[1] > Open[1]),1,0);
def Condition19 = if (Use2Bars and (Value21==Lowest(Value21,Lookback) and close > open and Close[1] > Open[1]),1,0);
def Condition20 = if (Use2Bars and (Value22==Lowest(Value22,Lookback)), 1,0);

plot Vol = volume;
plot VolAvg = Average(volume, lookback);


Vol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Vol.SetLineWeight(3);
Vol.AssignValueColor (

if (ClimaxChurn and (Condition10 or Condition20)) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9) then GetColor(ClimaxChurnColor) else

if (LowVol and (Condition1 or Condition11)) then GetColor(LowVolColor) else

if (ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or Condition12 or Condition13 or Condition18 or Condition19)) then GetColor(ClimaxUpColor) else

if (ClimaxDown and (Condition4 or condition5 or Condition6 or Condition7 or Condition14 or Condition15 or Condition16 or Condition17)) then GetColor(ClimaxDownColor) else

if (Churn and Condition10 or Condition20) then GetColor(ChurnColor) else
GetColor(DefaultBarColor));

VolAvg.SetDefaultColor(GetColor(AvgColor));


 



futures io > > > > Converting EasyLanguage Code to Thinkscript Code (TOS)
Thread Tools



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

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with thinkscript code vonso ThinkOrSwim Programming 1 October 16th, 2015 07:59 PM
Looking to hire someone to write thinkscript code aehartle ThinkOrSwim Programming 2 August 26th, 2015 06:31 PM
Code TRX Channel for TOS (MT4 Code here) rommark ThinkOrSwim Programming 0 October 1st, 2014 04:55 PM
Help with converting ToS script into Easylanguage (Volatility/STDeviation Indicators) mhc217 EasyLanguage Programming 1 January 11th, 2014 10:19 PM
Converting code Jbird10 EasyLanguage Programming 3 December 22nd, 2011 09:04 PM


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

Copyright © 2020 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