NexusFi: Find Your Edge


Home Menu

 





Convert Easy Language code into Thinkscript


Discussion in ThinkOrSwim

Updated
      Top Posters
    1. looks_one RedK with 8 posts (3 thanks)
    2. looks_two sboarder13 with 6 posts (1 thanks)
    3. looks_3 mightyatom with 3 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
      Best Posters
    1. looks_one esslash with 1 thanks per post
    2. looks_two GeorgeCgI with 1 thanks per post
    3. looks_3 RedK with 0.4 thanks per post
    4. looks_4 sboarder13 with 0.2 thanks per post
    1. trending_up 27,368 views
    2. thumb_up 6 thanks given
    3. group 9 followers
    1. forum 20 posts
    2. attach_file 6 attachments




 
Search this Thread

Convert Easy Language code into Thinkscript

  #1 (permalink)
sboarder13
Washington DC United States
 
Posts: 6 since Aug 2012
Thanks Given: 0
Thanks Received: 1

I am curious if someone can convert this easy language code into Thinkorswim Thinkscript code for me?

Attached Files
Elite Membership required to download: WAVEDOTS.ELD
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Deepmoney LLM
Elite Quantitative GenAI/LLM
Are there any eval firms that allow you to sink to your …
Traders Hideout
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
GFIs1 1 DAX trade per day journal
18 thanks
The Program
18 thanks
  #3 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145


Hi sboarder13,
can you include the code, or attach as .txt, and a quick description of what it does,

thx, RedK

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
sboarder13
Washington DC United States
 
Posts: 6 since Aug 2012
Thanks Given: 0
Thanks Received: 1

 
Code
Input: 
Length1 (20), 
Length2(50), 
Length3(100), 
ST_MA_Color(Yellow), 
MT_MA_Color(Cyan), 
LT_MA_Color(Magenta), 
Dot_Size (3), 
LineSize(1); 
 
Var: MA1(0),MA2(0),MA3(0); 
 
MA1 = XAverage(MBC,Length1); 
MA2 = XAverage(MBC,Length2); 
MA3 = XAverage(MBC,Length3); 
 
 
var:HiDisp(0),LoDisp(0),DispDiff(0); 
HiDisp = GetAppInfo (aiHighestDispValue); 
LoDisp = GetAppInfo (aiLowestDispValue); 
DispDiff = HiDisp - LoDisp; 
 
// for longs 
Var: LongLevel1(0),LongLevel2(0),LongLevel3(0); 
 
LongLevel1 = LoDisp + DispDiff*.16; 
LongLevel2 = LoDisp + DispDiff*.13; 
LongLevel3 = LoDisp + DispDiff*.10; 
 
// for shorts 
Var: ShortLevel1(0),ShortLevel2(0),ShortLevel3(0); 
 
ShortLevel1 = LoDisp + DispDiff*.90; 
ShortLevel2 = LoDisp + DispDiff*.87; 
ShortLevel3 = LoDisp + DispDiff*.84; 
 
If MA1 > MA1[1] then Plot1(LongLevel1,"ST-L.dot",ST_MA_Color, default,Dot_Size)else Noplot(1); 
If MA2 > MA2[1] then Plot2(LongLevel2,"MT-L.dot",MT_MA_Color,   default,Dot_Size)else Noplot(2); 
If MA3 > MA3[1] then Plot3(LongLevel3,"LT-L.dot",LT_MA_Color,default,Dot_Size)else Noplot(3); 
 
If MA1 < MA1[1] then Plot4(ShortLevel1,"ST-S.dot",ST_MA_Color, default,Dot_Size)else Noplot(4); 
If MA2 < MA2[1] then Plot5(ShortLevel2,"MT-S.dot",MT_MA_Color,   default,Dot_Size)else Noplot(5); 
If MA3 < MA3[1] then Plot6(ShortLevel3,"LT-S.dot",LT_MA_Color,default,Dot_Size)else Noplot(6);

Reply With Quote
  #5 (permalink)
sboarder13
Washington DC United States
 
Posts: 6 since Aug 2012
Thanks Given: 0
Thanks Received: 1

here is a screenshot of how it plots

Attached Thumbnails
Click image for larger version

Name:	Screen shot 2012-09-18 at 8.50.09 PM.png
Views:	794
Size:	275.9 KB
ID:	90378  
Reply With Quote
  #6 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

thanks .. that's the same concept in K_Trender (Elite section).. tracking price against a set of 3 MA's of varying lengths..

the visualization is different though (you just see a dot when the price crosses one of them - 3 different levels) where in K_Trender we also get 2 momentum lines (Fast & Slow) out of these MA's..

should be easy to do in ToS..

will get back to you,
RedK

Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

there you go .. added an option to show/hide the MA's ..
hope this helps,
RedK



 
Code
input ShortLength = 20;
input MedLength = 50;
input LongLength = 100;
input price = Close;
Input Showlines = No;

Plot MA1 = ExpAverage(price, ShortLength);
Plot MA2 = ExpAverage(price, MedLength);
Plot MA3 = ExpAverage(price, LongLength);

# format the lines and option to show/hide
MA1.setdefaultColor (color.yellow); MA1.sethiding(!ShowLines);
MA2.setdefaultColor (color.Cyan); MA2.sethiding(!ShowLines);
MA3.setdefaultColor (color.Magenta); MA3.sethiding(!ShowLines);

#calc screen area for plot and assign plot levels
def LongLevel = HighestAll (high) * 1.05;
def ShortLevel = LowestAll(low) * 0.95;
def DispDiff = LongLevel - ShortLevel;


def LongL1 = LongLevel - DispDiff * 0.09;
def LongL2 = LongLevel  - DispDiff * 0.05;
def LongL3 = LongLevel - DispDiff * 0.01;

def ShortL1 = ShortLevel + DispDiff * 0.02;
def ShortL2 = ShortLevel + DispDiff * 0.04;
def ShortL3 = ShortLevel + DispDiff * 0.06;

# plot the dot if the corresponding MA is going up .. for Longs
plot LongLevel1 = if MA1 > MA1[1] then LongL1 else Double.NaN;
plot LongLevel2 = if MA2 > MA2[1] then LongL2 else Double.NaN;
plot LongLevel3 = if MA3 > MA3[1] then LongL3 else Double.NaN;
LongLevel1.SetPaintingStrategy (PaintingStrategy.SQUARES);
LongLevel1.SetDefaultColor(Color.YELLOW);
LongLevel1.SetLineWeight (2);
LongLevel2.SetPaintingStrategy (PaintingStrategy.SQUARES);
LongLevel2.SetDefaultColor(Color.CYAN);
LongLevel2.SetLineWeight (2);
LongLevel3.SetPaintingStrategy (PaintingStrategy.SQUARES);
LongLevel3.SetDefaultColor(Color.MAGENTA);
LongLevel3.SetLineWeight (2);

# plot the dot if the corresponding MA is going down .. for shorts
plot ShortLevel1 = if MA1 < MA1[1] then ShortL1 else Double.NaN;
plot ShortLevel2 = if MA2 < MA2[1] then ShortL2 else Double.NaN;
plot ShortLevel3 = if MA3 < MA3[1] then ShortL3 else Double.NaN;
ShortLevel1.SetPaintingStrategy (PaintingStrategy.SQUARES);
ShortLevel1.SetDefaultColor(Color.YELLOW);
ShortLevel1.SetLineWeight (2);
ShortLevel2.SetPaintingStrategy (PaintingStrategy.SQUARES);
ShortLevel2.SetDefaultColor(Color.CYAN);
ShortLevel2.SetLineWeight (2);
ShortLevel3.SetPaintingStrategy (PaintingStrategy.SQUARES);
ShortLevel3.SetDefaultColor(Color.MAGENTA);
ShortLevel3.SetLineWeight (2);

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 
RedK's Avatar
 RedK 
Dubai, UAE
 
Experience: Intermediate
Platform: TOS, TradeStation
Broker: OX, TradeStation
Trading: Stocks & Basic Options
Posts: 171 since May 2012
Thanks Given: 44
Thanks Received: 145

although i would use this a little differently .. i would build the singals (the dots) in a way that when price goes above the short MA, i get 1st dot, then above 2nd MA, I get 2nd dot, then above 3rd MA i get a 3rd dot - and that means a full uptrend formation .. same going down ..

but i kept it the way it is.. thx,
RedK

Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
sboarder13
Washington DC United States
 
Posts: 6 since Aug 2012
Thanks Given: 0
Thanks Received: 1

Hey I appreciate it the only thing I see though is that in an uptrend like the chart you have posted the dots are on the top instead of on the bottom essentially meaning support. Anyway you could change this around?

Reply With Quote
  #10 (permalink)
sboarder13
Washington DC United States
 
Posts: 6 since Aug 2012
Thanks Given: 0
Thanks Received: 1


I plotted this on a 5minute chart of the /YM and the plots are way above and below price in order to see them the chart is unreadable. Here is an example of what I get when putting them on a daily AAPL chart which is different than yours.

Attached Thumbnails
Click image for larger version

Name:	AAPLDaily.PNG
Views:	469
Size:	141.9 KB
ID:	90450  
Reply With Quote




Last Updated on November 22, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts