NexusFi: Find Your Edge


Home Menu

 





Thinkscript to Easy Language


Discussion in TradeStation

Updated
      Top Posters
    1. looks_one jflippin with 3 posts (0 thanks)
    2. looks_two markmanu with 3 posts (0 thanks)
    3. looks_3 cbritton with 1 posts (2 thanks)
    4. looks_4 rmiller863 with 1 posts (0 thanks)
    1. trending_up 6,018 views
    2. thumb_up 2 thanks given
    3. group 3 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread

Thinkscript to Easy Language

  #1 (permalink)
jflippin
Omaha, NE
 
Posts: 3 since Oct 2012
Thanks Given: 1
Thanks Received: 0

I'm struggling to learn this code.. Trying to convert my very simple watchlist script into a radar screen function of easy language. This is the code if anyone can help out maybe it will start to click after this I am hoping. Thanks in advance.


def dmiplus = DMI(length = 14)."DI+";
def dmiminus = DMI(length = 14)."DI-";


def isBull = dmiplus > dmiminus and dmiplus[1] <= dmiminus[1];
def isBear = dmiplus < dmiminus and dmiplus[1] >= dmiminus[1];
plot PlotBull = if isBull then 1 else if isBear then -1 else 0;
PlotBull.assignValueColor(if isBull then color.UPTICK else if isBear then color.DOWNTICK else CreateColor(237, 237, 237));
assignBackgroundColor(if isBull then color.UPTICK else if isBear then color.DOWNTICK else CreateColor(237, 237, 237));

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
How to apply profiles
Traders Hideout
 
  #2 (permalink)
 
cbritton's Avatar
 cbritton 
Atlanta, Georgia
 
Experience: Intermediate
Platform: NT
Broker: DDT
Trading: ZN, ZB
Posts: 230 since Mar 2010
Thanks Given: 152
Thanks Received: 256

Here's a simple indicator based on your tos code. I don't have experience with radarscreen so you might need to add a few function calls to change the cell colors, etc. If you really need it, I can try. Let me know.


 
Code
vars:
	dmipl(0),
	dmimi(0),
	isBull(false),
	isBear(false);
	
dmipl = dmiplus(14);
dmimi = dmiminus(14);

if dmipl > dmimi and dmipl[1] <= dmimi[1] then isBull = true else isBull = false;
if dmipl < dmimi and dmipl[1] >= dmimi[1] then isBear = true else isBear = false;

value1 = iff (isBull, 1, iff(isBear, -1, 0));

Plot1(value1, "DMI +-");
Plot2(0, "UPTICK");
plot3(0, "DNTICK");
noPlot(2);
noPlot(3);

if isBull then setPlotcolor(1, getPlotColor(2)) 
else if isBear then setPlotcolor(1, getPlotColor(3))
else setPlotcolor(1, rgb(237, 237,237));


Hope this helps,
-C

“Strategy without tactics is the slowest route to victory. Tactics without strategy is the noise before defeat.” - Sun Tzu
Reply With Quote
Thanked by:
  #3 (permalink)
jflippin
Omaha, NE
 
Posts: 3 since Oct 2012
Thanks Given: 1
Thanks Received: 0


Thanks a lot this is great! I certainly appreciate the quick response!

Reply With Quote
  #4 (permalink)
jflippin
Omaha, NE
 
Posts: 3 since Oct 2012
Thanks Given: 1
Thanks Received: 0

I think I am getting close.. It seems to work but what I was hoping for was only indicate for a current crossing otherwise the cell should be white.. Anyway this is what I have. I am struggling with if the cell isn't 1 or -1 I am wanting it to be white or black(just not setting a color if there is no cross). I hope this makes sense. Thanks again

vars:
dmipl(0),
dmimi(0),
isBull(false),
isBear(false),
LongShort("");


dmipl = dmiplus(14);
dmimi = dmiminus(14);

if dmipl > dmimi and dmipl[1] <= dmimi[1] then isBull = true else isBull = false;
if dmipl < dmimi and dmipl[1] >= dmimi[1] then isBear = true else isBear = false;

value1 = iff (isBull, 1, iff(isBear, -1,0));

var:color(0); color = yellow;

if value1 = 1 then begin

Color = Green;
End
Else Begin

Color = red;
End;

If value1 > 0 then begin
LongShort = "Long";
End
else begin
LongShort = "Short" ;
End;

If LongShort = "Short" then Color = red
Else Color = green;

SetPlotBGColor(6, color);
SetPlotColor(6, white);
Plot6(LongShort, "LongShort");

Reply With Quote
  #5 (permalink)
 rmiller863 
Lake wales FL/ USA
 
Experience: Intermediate
Platform: TOS ,Tradestation, Sierra
Trading: Futures
Posts: 41 since Jul 2013
Thanks Given: 9
Thanks Received: 2

Im looking for someone who knows how to code that could help me with this. I need this converted from thinkscript to easy language. Any help is much appreciated. Thanks in advance.

# sdi_psarstgy:
#hint:Strategy to evaluate trading parabolic-stop-and-reverse signals http://ww1.smalldoginvestor.com/?usid=24&utid=7393946367 rev:1.1.0
# author: allen everhart
# date: 16may2014
# revisions:
# 4jun2014-added %win label, corrected reverse price on gaps
input dollarsPerTrade = 10000;
#hint dollarsPerTrade: trades vary in share size in order to keep the invested dollars constant to create a fair comparison to passive strategies. http://ww1.smalldoginvestor.com/?usid=24&utid=7393946367 rev: 1.1.0
input accelerationFactor = 0.02;
#hint accelerationFactor: controls how steep a parabola is traced by the stop.
input accelerationLimit = 0.2;
#hint accelerationLimit: after the limit is reached the stop moves up in a straight line.

def psar = ParabolicSAR( "acceleration limit" = accelerationLimit, "acceleration factor" = accelerationFactor);
def buySig = close crosses above psar;
def sellSig = close crosses below psar;
def shareSize = round(dollarsPerTrade/psar,0) ;
def buyPrice=#psar;
if open[-1]>psar then open[-1]
else psar;
def sellPrice= #psar;
if open[-1]<psar then open[-1]
else psar;
AddOrder(OrderType.BUY_AUTO, buySig[-1], price = buyPrice, tradeSize=shareSize, name = "buy");
AddOrder(OrderType.SELL_AUTO, sellSig[-1], price = sellPrice, tradeSize=shareSize, name="short");
plot parSAR = psar;
parsar.setPaintingStrategy(paintingStrategy.POINTS);
parSar.setDefaultColor(color.rED);

def longPrice=compoundValue(1,
if !longPrice[1] && buySig[-1] then buyPrice
else if longPrice[1] && sellSig[-1] then 0
else longPrice[1]
,0
);
#plot lp=longPrice;
def shortPrice=compoundValue(1,
if !shortPrice[1] && sellSig[-1] then sellPrice
else if shortPrice[1] && buySig[-1] then 0
else shortPrice[1]
,0
);
#plot sp=shortPrice;

def wincntr= compoundValue(1,
if longPrice[1] && sellSig[-1] && sellPrice>longPrice[1] then wincntr[1]+1
else if shortPrice[1] && buySig[-1] && shortPrice[1]>buyPrice then wincntr[1]+1
else wincntr[1]
,0
);
def winNum=if isnan(wincntr) then winNum[1] else wincntr ;
def losscntr= compoundValue(1,
if longPrice[1] && sellSig[-1] && sellPrice<=longPrice[1] then losscntr[1]+1
else if shortPrice[1] && buySig[-1] && shortPrice[1]<=buyPrice then losscntr[1]+1
else losscntr[1]
,0
);
def lossNum=if isnan(lossCntr) then lossNum[1] else lossCntr ;

addlabel(1,
concat( "win: ",
concat( round( 100*winNum/(winNum+lossNum),1),
concat( "% of ", winNum+lossNum))),

color.BLUE);
#####################

Reply With Quote
  #6 (permalink)
markmanu
Kansas
 
Posts: 6 since Dec 2018
Thanks Given: 0
Thanks Received: 1

Can anyone please let me know how to convert thinkscript to easylanguage?
Is there any approach to do it?
Thanks

Reply With Quote
  #7 (permalink)
markmanu
Kansas
 
Posts: 6 since Dec 2018
Thanks Given: 0
Thanks Received: 1

Can anyone please help me to convert this thinkscript code to easylanguage?
I would very appreciate.



declare upper;

input avglength = 14;
input MTaverageType = AverageType.WILDERS;
input ATRLength = 5;

##DayATR Value Calculation
def highPrice = FundamentalType.high;
def closePrice = FundamentalType.close;
def lowPrice = FundamentalType.low;
def aggregationPeriod = AggregationPeriod.DAY;
rec AvgTrueRange = MovingAverage(AverageType.SIMPLE, TrueRange(Fundamental (highPrice, period = AggregationPeriod.Day), Fundamental (closePrice, period = AggregationPeriod.DAY), Fundamental (lowPrice, period = AggregationPeriod.DAY) ),ATRlength);

Reply With Quote




Last Updated on December 21, 2018


© 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