TOS Script - error? what am i doing wrong? - futures io
futures io futures trading



TOS Script - error? what am i doing wrong?


Discussion in ThinkOrSwim

Updated by ticker
    1. trending_up 3,011 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 2 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)

 
Search this Thread
 

TOS Script - error? what am i doing wrong?

(login for full post details)
  #1 (permalink)
Houston TX
 
Experience: Advanced
Platform: NinjaTrader
Trading: TF
 
ticker's Avatar
 
Posts: 49 since Oct 2010
Thanks: 63 given, 9 received

To my TOS wiz's, Id appreciate any help you may offer.

The following code is giving me an error "Invalid state: if at 2:1"

def b = (condition here...) ;
if (b = 0) {
b = 1;
}

It is not liking my if statement (without an else). Im basically trying to say, if b = 0, then make it a 1 instead, or else leave it alone as b.

Thanks to anyone who may help.
Ticker

Reply With Quote

Can you help answer these questions
from other members on futures io?
Price Down, Volume Up, Open Interest Down
Traders Hideout
EQIX - Digital REITs - any experiences?
Stocks and ETFs
IB Bracker Order
Platforms and Indicators
T​​​​​​radestation datafeed (real time and historical) to NT8
NinjaTrader
Stacked Imbalances.
Sierra Chart
 
 
(login for full post details)
  #2 (permalink)
desert CA
 
Experience: Intermediate
Platform: NT7, TOS, CQG-trader
Broker: AMP, DT, TDA
Trading: CL,NQ,YM
 
Posts: 2,130 since Jul 2011
Thanks: 2,368 given, 1,707 received

Hi, there's no branching if-then-else statement by itself. It's usually a contained expression in other statements. Here's what should work.


def i = ( condition );
def b = if (i == 0) then 1 else i;

Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Cloudy for this post:
 
(login for full post details)
  #3 (permalink)
Houston TX
 
Experience: Advanced
Platform: NinjaTrader
Trading: TF
 
ticker's Avatar
 
Posts: 49 since Oct 2010
Thanks: 63 given, 9 received



Cloudy View Post
Hi, there's no branching if-then-else statement by itself. It's usually a contained expression in other statements. Here's what should work.


def i = ( condition );
def b = if (i == 0) then 1 else i;

That worked excellent. Thank you @Cloudy !

Reply With Quote
The following user says Thank You to ticker for this post:


futures io Trading Community Platforms and Indicators ThinkOrSwim > TOS Script - error? what am i doing wrong?


May 3, 2013


Upcoming Webinars and Events
     



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