NexusFi: Find Your Edge

Home Menu


Turtle TS-code help needed from programmers

Discussion in EasyLanguage Programming

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

Search this Thread

Turtle TS-code help needed from programmers

(login for full post details)
  #1 (permalink)
Posts: 14 since May 2011
Thanks Given: 6
Thanks Received: 3


I am relatively new to Tradestation and would need some help from expierenced TS programmers in understanding below attached Turtle strategy.

I am hoping that there are some members which can help me to fully understand below code.

Below is the first part of mentioned Turtle strategy attached, including my comments as I think the instrcutions will be executed, on some statements I simply have no clue what they are really doing, hopefully some members can explain them in detail.

Currently I donīt think it makes sense to post the entire strategy, so I will go ahead and post below the first part

In BLUE are my comments, as I said, would be great if somebody can tell me if my analysis of below code is correct and on sections where I simply donīt know whats going on if possible please provide some further assistance.

Thanks a lot to everbody!

Below are the first 30% of given TS code:

[LegacyColorValue = true];
{ Turtle mode #2 Ver.0.1.0 03.02.2005}

Input: DistH(4),DistL(4),Account(10000),MaxPercRisk(1),MaxOpenEntry(4);





if Barnumber=1 then begin {Start with 1 bar on chart}
VALUE29=-1; {Numeric value set to -1, for later usage, currently donīt know the meaning of -1}
VALUE38=-1; {Numeric value set to -1, for later usage, currently donīt know the meaning of -1}

{"CurrentEntries" -->numbers of entries currentlyopen, assigned to"cCurrentEntires"}

{AvgEntryPrice --> Average price of all currently open entries --> assigned to "cAvgEntryPrice"}

{CurrentContracts --> Number of contracts currently open --> assigned to "cCurrentContracts"}

if (cCurrentEntries>cCurrentEntries[1]) then begin
{(cCurrentEntries>cCurrentEntries[1]) --> if "cCurrentEntries" is bigger that the one from yesterday, but so far there are no trades made, value for both is still 0, condition not met, jump to next "if" --> if (cCurrentEntries=0 and cCurrentEntries[1]<>0) then begin}

cEntryPrice=(CurrentContracts*AvgEntryPrice-cCurrentContracts[1]*cAvgEntryPrice[1]) / (CurrentContracts-cCurrentContracts[1]);
{Calculation for var "cEntryprice" --> (Number of currently held contracts * average price of all currently open entries) - ( values from yesterday) / (currently held contract - the ones from yesterday)}

--> same thing: currently no trades in progress, all vars still set to 0
--> What does "cEntryPrice" basically say? actually donīt understand the meaning of this calculation.

if MarketPosition=1 then begin
{ if long than continue --> condition not met, no trades in progress}

{ I guess thatīs the "2N" initial stop calculation according to Turtle rules}

{no idea...., whats the meaning of this "NextHigh"?}

{no idea...., whats the meaning of this "NextHigh"?}

{predefined vars, as above. Whatīs the reason to have them all on -1?)

{predefined vars, as above)

{predefined vars, as above)

{predefined vars, as above)

else begin
SExitStop=TicksRound(cEntryPrice+2*XAverage(TrueRange,20)); {same as above, just SExit)
NextLow=cEntryPrice-0.5*XAverage(TrueRange,20); {no idea...., whats the meaning of this?}
NextLow=TicksRound(NextLow-TicksMTS(NextLow)); {no idea...., whats the meaning of this?}
{predefined vars, as above. Whatīs the reason to have them all on -1?)
SellLimit=-1; {predefined vars, as above)
BarUntil=-1; {predefined vars, as above)
VALUE38=-1; {predefined vars, as above)

{ Date & Time line for multiple entries Buy / Sell }
value99=date; {predefined numeric values --> date}
value98=time; {predefined numeric value --> time}

if (cCurrentEntries=0 and cCurrentEntries[1]<>0) then begin
{cCurrentEntries is 0, but cCurrentEnties from yesterday is equal to 0 --> condition not met to proceed, so far no trades made}

if VALUE29>=0 then {so far value29 is still set to 0, cannot proceed}

TL_Delete(VALUE29); {delete trendline}

{in case value29 changed --> now re-setting "value29" to -1}
if VALUE38>=0 then {so far value38 is still set to 0, cannot proceed}
TL_Delete(VALUE38); {delete trendline}
VALUE38=-1; {in case value38 changed --> now re-setting "value38" to -1}

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Futures Close-Out Policy
NT7 Indicator Script Troubleshooting - Camarilla Pivots
Request for MACD with option to use different MAs for fa …
Looking for an MQL4 MetaTrader programmer/coder
The Elite Circle
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
33 thanks
Daytrading ES & NQ
32 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Retail Trading As An Industry
25 thanks
Battlestations: Show us your trading desks!
24 thanks

Last Updated on May 11, 2011

© 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