case statements in TOS - futures io
futures io futures trading



case statements in TOS


Discussion in ThinkOrSwim

Updated by ZachC
    1. trending_up 273 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 replies
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Thread Tools Search this Thread
 

case statements in TOS

  #1 (permalink)
Pennsylvania
 
Experience: Intermediate
Platform: ThinkorSwim
Broker: TastyTrade
Trading: Micro ES and Micro YM
 
ZachC's Avatar
 
Posts: 11 since Jun 2019
Thanks: 12 given, 10 received

case statements in TOS

Having a hell of a time trying to figure out case statements. I am 100% sure I am using the correct syntax but I am still getting errors in TOS that the value never assigned at <insert case variable>. Anyone able to see whats wrong with the code?

 
Code
input EnhancedLong = {default BasicLong, SimpleLong, AggressiveLong};
input EnhancedShort = {default BasicShort, SimpleShort, AggressiveShort};


def trLong;
switch (EnhancedLong) {
case BasicLong:
    trLong = TrendPeriods() == 1;
case SimpleLong:
    trLong = TrendQuality().TQ[0] > TrendQuality().TQ[1] or TrendQuality().TQ >= 0;
case AggressiveLong:
    trLong = TrendQuality().TQ[0] > TrendQuality().TQ[1] and TrendQuality().TQ[1] > TrendQuality().TQ[2];
}

def trShort;
switch (EnhancedShort) {
case BasicShort:
    trShort = TrendPeriods() == 1;
case SimpleShort:
    trShort = TrendQuality().TQ[0] > TrendQuality().TQ[1] or TrendQuality().TQ >= 0;
case AggressiveShort:
    trShort = TrendQuality().TQ[0] > TrendQuality().TQ[1] and TrendQuality().TQ[1] > TrendQuality().TQ[2];
}
Any help would be greatly appreciated!! Thanks!

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote

Can you help answer these questions
from other members on futures io?
Convert NinjaTrader NT7 indicator to Tradestation EasyLanguage and RADARSCREEN
Platforms and Indicators
Issue meeting order entry conditions
Elite Automated NinjaTrader Trading
Last 5 minutes Label
ThinkOrSwim
Moving average with Lag reduction
NinjaTrader
Linux?
ThinkOrSwim
 
 
  #2 (permalink)
Pennsylvania
 
Experience: Intermediate
Platform: ThinkorSwim
Broker: TastyTrade
Trading: Micro ES and Micro YM
 
ZachC's Avatar
 
Posts: 11 since Jun 2019
Thanks: 12 given, 10 received


ZachC View Post
Having a hell of a time trying to figure out case statements. I am 100% sure I am using the correct syntax but I am still getting errors in TOS that the value never assigned at <insert case variable>. Anyone able to see whats wrong with the code?

 
Code
input EnhancedLong = {default BasicLong, SimpleLong, AggressiveLong};
input EnhancedShort = {default BasicShort, SimpleShort, AggressiveShort};


def trLong;
switch (EnhancedLong) {
case BasicLong:
    trLong = TrendPeriods() == 1;
case SimpleLong:
    trLong = TrendQuality().TQ[0] > TrendQuality().TQ[1] or TrendQuality().TQ >= 0;
case AggressiveLong:
    trLong = TrendQuality().TQ[0] > TrendQuality().TQ[1] and TrendQuality().TQ[1] > TrendQuality().TQ[2];
}

def trShort;
switch (EnhancedShort) {
case BasicShort:
    trShort = TrendPeriods() == 1;
case SimpleShort:
    trShort = TrendQuality().TQ[0] > TrendQuality().TQ[1] or TrendQuality().TQ >= 0;
case AggressiveShort:
    trShort = TrendQuality().TQ[0] > TrendQuality().TQ[1] and TrendQuality().TQ[1] > TrendQuality().TQ[2];
}
Any help would be greatly appreciated!! Thanks!

Fail on my part I had double copied the input code which was causing TOS to short circuit oops

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote



futures io Trading Community Platforms and Indicators ThinkOrSwim > case statements in TOS




Upcoming Webinars and Events
 

Free BloodHound Licenses to everyone!

June
 

Every journal equals ten meals for the hungry

June
     



Copyright © 2020 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts