Online: Visits: Stories:
Contributor profile | More stories
 Story Views Now: Last Hour: Last 24 Hours: Total:

# Need Help with ThinkOrSwim’s ThinkScript

Sunday, November 20, 2016 10:06

Headline: Bitcoin & Blockchain Searches Exceed Trump! Blockchain Stocks Are Next!

I’m attempting to learn and apply the fold command in TOS, but my code is not plotting correctly. Could someone take a look at it and get it to work? I know how to code DO LOOPS in basic language and I’m having trouble doing it in TS. One problem that I have with this is controlling the increments in the iteration. I don’t get any syntax errors, but this code does not plot correctly and I cannot figure out why. It should plot horizontal lines at different levels.

************************* ************************* ***
def HAV = HighestAll(High);
def LAV = LowestAll(Low);

input Direction = {default GridUp, GridDown};
input n = 4;

#
# ========================= ========================= ==========
# SWITCH BETWEEN DIRECTIONS
# ========================= ========================= ==========
#
def Mode;

switch (Direction)
{
case GridUp:
Mode = 1;
case GridDown:
Mode = 0;
}

def StartPoint = if Mode == 1 then LAV else HAV;

plot GannLine = fold i = 1 to n
with j = 45
do if Mode == 1 then Sqrt(StartPoint) + ((i * j)/180)
else Sqrt(StartPoint) – ((i * j)/180);

### Top Global

 Putin's Major Moves, Scary A.I Artificial Intelligence Expansion Is Here _Luke Rudkowski Exclusive: Tracing the ISIS Weapons Supply Chain — Back to the US X22Report Oh Snap! Hold on to Your Seat, the Entire Economy Is About to Change. Truth Being Forced Into Open! What You Need To Know On This & More (Videos) Why Do They Hate Us? America’s Super-Rich Have Taken Nearly 70% of the World’s Wealth Gains Since 2012 Firegeddon: Weather Warfare and Environmental Terrorism With a Hidden Purpose King Solution 05: How the Global Currency Reset & Earth Mega Event should be released & unfold Apocalyptic Fires in SoCal, Winds Shift Toward Santa Barbara -Video Mighty Snowstorm in Turkey Drops 1 Meter of Snow in 12 Hours Jerusalem Is A ‘Cup Of Trembling’ Because Both The Devil And Jesus Christ Claim It For Their Kingdoms Trump's Great Gifts to Israel and America

### Top Alternative

 How Many Times Do I Have to Say This? Putin's Major Moves, Scary A.I Artificial Intelligence Expansion Is Here _Luke Rudkowski Trump Update 12/12/2017.."Your Mind Is in the Gutter!" Revealed: Secret Mega-Donors to Anti-Trump Resistance Group (Video) Stupidity and Blindness Have Destroyed Whatever Democracy the US Ever Had Soros Bankrolls Trump Sexual Harassment Allegations The Kilroy Free Speech Event - Why I Will Not Be Speaking There Any Longer _Tim Pool Muslim Ban? Fewer Muslim Refugees, Immigrants, and Travelers Enter U.S. in 2017 Korean Threat Driving Missile Defense Buildup Across the Far East Artificial Intelligence to Scan Your Thoughts Facebook Announces (Video)

Register