NexusFi: Find Your Edge


Home Menu

 





TOS fold loop to easylanguage


Discussion in EasyLanguage Programming

Updated
    1. trending_up 1,804 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

TOS fold loop to easylanguage

  #1 (permalink)
 kjhosken 
Seattle, WA/USA
 
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35

Hi all,
I'm trying to convert a TOS script that I have to tradestation and I'm having a doosey of a time figuring this out. I'm relatively new to TS and have only a fairly basic level of programming knowledge, so I'm hoping someone with more knowledge of loops than I can lend a hand.

Original TOS code:
 
Code
#Classify Volumes
def V_Rank         = fold vi = -4 to 5 with iVRank = 0 do if V > Power(Double.E, V_LNmu + V_LNsigma * ((vi == -4) * ((-V_LNmu + Log(TickSize() / 2) / V_LNsigma)) + (vi == -3) * (-1 * ExtremeDev) + (vi == -2) * (-1 * LargeDev) + (vi == -1) * (-1 * AboveNormalDev) + (vi ==  0) * (-1 * NormalDev) + (vi ==  1) * (NormalDev) + (vi ==  2) * (AboveNormalDev) + (vi ==  3) * (LargeDev) + (vi ==  4) * (ExtremeDev))) then vi else iVRank;
What I've got in TS so far (it's rather pathetic):
 
Code
Const:
	e(2.71828);
//Classify Volumes
For vi = -4 to 5 w
Begin 
	while ivRank = 0;
	if V > Power(e, V_LNmu + V_LNsigma * ((vi = -4) * ((-V_LNmu + Log(TickSize() / 2) / V_LNsigma)) + (vi = -3) * (-1 * ExtremeDev) + (vi = -2) * (-1 * LargeDev) + (vi = -1) * (-1 * AboveNormalDev) + (vi =  0) * (-1 * NormalDev) + (vi =  1) * (NormalDev) + (vi =  2) * (AboveNormalDev) + (vi =  3) * (LargeDev) + (vi =  4) * (ExtremeDev))) 
	then V_Rank = vi else V_Rank = iVRank;

Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
Quant vue
Trading Reviews and Vendors
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
What is Markets Chat (markets.chat) real-time trading ro …
77 thanks
Spoo-nalysis ES e-mini futures S&P 500
55 thanks
Just another trading journal: PA, Wyckoff & Trends
38 thanks
Bigger Wins or Fewer Losses?
24 thanks
The Program
17 thanks
  #3 (permalink)
 edgefirst 
Las Cruces, NM
 
Experience: Advanced
Platform: Tradestation, MC, NT
Broker: TradeStation, IB
Trading: Liquid futures contracts
Posts: 56 since Sep 2009
Thanks Given: 389
Thanks Received: 86


Hi kjhosken,

The TOS code is quite convoluted. Here is the EL code:

 
Code
Const: e(2.71828);
vars: V_rank(0), vi(0);
array: X[10](0);

V_rank = 0;

X[1] =  (-V_LNmu + Log(TickSize() / 2) / V_LNsigma);
X[2] = -1 * ExtremeDev;
X[3] =  (-1 * LargeDev);
X[4] = (-1 * AboveNormalDev);
X[5] = (-1 * NormalDev);
X[6] = NormalDev;
X[7] = AboveNormalDev;
X[8] = LargeDev;
X[9] = ExtremeDev;
X[10] = 0;

for vi = -4 to 5 begin
    if  V > Power(e, V_LNmu + V_LNsigma * (X[vi + 5])) then
        V_Rank = vi;
end;

Reply With Quote




Last Updated on February 27, 2019


© 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