NexusFi: Find Your Edge


Home Menu

 





TOS fold loop to easylanguage


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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 X Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
TradingView Deploys AI to Monitor SEC Filings in Real Ti …
TradingView
Netherlands & Germany Surge as World Cup Field Narro …
Prediction Markets & Event Contracts
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
Orban at 29pct as Hungary Votes Tomorrow -- McIlroy Surg …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 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: 87


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


© 2026 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 - Downloads - Top
no new posts