NexusFi: Find Your Edge


Home Menu

 





need help with switch statement error


Discussion in ThinkOrSwim

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




 
Search this Thread

need help with switch statement error

  #1 (permalink)
buufkev
Las Vegas, Nevada
 
Posts: 2 since Mar 2022
Thanks Given: 1
Thanks Received: 1

Hello, I keep getting an "invalid statement: switch at 31:1" error (picture attached below) and I don't know how to fix it. If anyone can help, it would be super appreciated!

declare lower;

input display = {default NYSE, All_Exchanges, NASDAQ, AMEX};

def uvolny = close("$UVOL");
def dvolny = close("$DVOL");
def uvolq = close("$UVOL/Q");
def dvolq = close("$DVOL/Q");
def uvola = close("$UVOA");
def dvola = close("$DVOA");

def tvolq = close("$TVOL/Q");
def tvola = close("$TVOA");
def tvolny = close("$TVOL");

def unchy = tvolny - uvolny - dvolny;
def unchq = tvolq - uvolq - dvolq;
def uncha = tvola - dvola - uvola;

def tvolall = tvolny + tvolq + tvola;

def uvol = uvolny + uvolq + uvola;
def dvol = dvolny + dvolq + dvola;

#
# Define the plots:
#

plot VolRatio;

switch (display){
case All_Exchanges:
VolRatio = if (uvol >= dvol,(uvol / tvolall)*100, -(dvol / tvolall)*100);
case NYSE:
Volratio = if (uvolny >= dvolny, ((uvolny / tvolny)*100), - ((dvolny / tvolny)*100));
case NASDAQ:
Volratio = if (uvolq >= dvolq, (uvolq / dvolq)*100, - (dvolq / tvolq)*100);
case AMEX:
Volratio = if (uvola >= dvola, (uvola / tvola)*100, - (dvola / tvola)*100);

}

#
# Formatting:
#
VolRatio.SetDefaultColor(color.cyan);
VolRatio.SetLineWeight(1);




Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Better Renko Gaps
The Elite Circle
Exit Strategy
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
16 thanks
  #2 (permalink)
 Miesto 
Monte Carlo, Monaco
Legendary Market Wizard
 
Experience: Advanced
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: Futures
Posts: 647 since May 2012
Thanks Given: 799
Thanks Received: 1,193

You can try with quotes:

switch (display){
case "All_Exchanges":
VolRatio = if (uvol >= dvol,(uvol / tvolall)*100, -(dvol / tvolall)*100);
case "NYSE":
Volratio = if (uvolny >= dvolny, ((uvolny / tvolny)*100), - ((dvolny / tvolny)*100));
case "NASDAQ":
Volratio = if (uvolq >= dvolq, (uvolq / dvolq)*100, - (dvolq / tvolq)*100);
case "AMEX":
Volratio = if (uvola >= dvola, (uvola / tvola)*100, - (dvola / tvola)*100);

}

Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #3 (permalink)
buufkev
Las Vegas, Nevada
 
Posts: 2 since Mar 2022
Thanks Given: 1
Thanks Received: 1



Mich62 View Post
You can try with quotes:

switch (display){
case "All_Exchanges":
VolRatio = if (uvol >= dvol,(uvol / tvolall)*100, -(dvol / tvolall)*100);
case "NYSE":
Volratio = if (uvolny >= dvolny, ((uvolny / tvolny)*100), - ((dvolny / tvolny)*100));
case "NASDAQ":
Volratio = if (uvolq >= dvolq, (uvolq / dvolq)*100, - (dvolq / tvolq)*100);
case "AMEX":
Volratio = if (uvola >= dvola, (uvola / tvola)*100, - (dvola / tvola)*100);

}

thank you!

Reply With Quote
Thanked by:




Last Updated on March 22, 2022


© 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