2 conditions IF statement ? - ThinkOrSwim Programming | futures io social day trading
futures io futures trading


2 conditions IF statement ?
Updated: Views / Replies:131 / 6
Created: by kblaine123 Attachments:0

Welcome to futures io.

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

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

2 conditions IF statement ?

  #1 (permalink)
houston
 
 
Posts: 8 since Feb 2018
Thanks: 2 given, 1 received

2 conditions IF statement ?

I thought you could use 2 conditions within an If statement ?

Simple Example....RSI crossover signal

Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);

This does not work.....am I doing something wrong ? Or is it just not accepted, seems like I used it long ago but not working now.

Any help ? Thanks in advance

Reply With Quote
 
  #2 (permalink)
Legendary Market Wizard
Chicago Illinois USA
 
Trading Experience: Advanced
Broker/Data: IB, ToS
Favorite Futures: /ES, US Equities/Options
 
wldman's Avatar
 
Posts: 2,625 since Aug 2011
Thanks: 1,327 given, 4,295 received

I think...

that you can create both a hierarchy or a confluence. But I have no idea how. Back in the day we built a "scoring" that was based on a series of "if then" type statements.

Best of luck with this.

-Dan

Visit my futures io Trade Journal Reply With Quote
 
  #3 (permalink)
houston
 
 
Posts: 8 since Feb 2018
Thanks: 2 given, 1 received



kblaine123 View Post
I thought you could use 2 conditions within an If statement ?

Simple Example....RSI crossover signal

Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);

This does not work.....am I doing something wrong ? Or is it just not accepted, seems like I used it long ago but not working now.

Any help ? Thanks in advance


Weird.....I tried again with the above and it did give me output, then I changed it to whats shown below and no signals at all !

Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);
Plot crossover2 = if(rsi<50 and rsi[1[]>50,1,double.nan);

Reply With Quote
The following user says Thank You to kblaine123 for this post:
 
  #4 (permalink)
 Vendor: www.abctradinggroup.com 
Hamburg Germany
 
Trading Experience: Advanced
Platform: Multicharts, Tradestation
Broker/Data: DTN IQ
Favorite Futures: ES
 
Posts: 2,073 since Apr 2013
Thanks: 371 given, 1,323 received

kblaine123,

your code snippet "rsi[1[]" might set brackets incorrectly, but without seeing your full code it's hard to tell where the problem comes from exactly.
Apart from that you should also be able to check for a cross over using something along the lines of:
 
Code
plot Crossover = RSI(close, 14) crosses above 50;

plot Crossunder = RSI(close, 14) crosses under 50;

plot Cross = RSI(close, 14) crosses 50;
Regards,

ABCTG



kblaine123 View Post
Weird.....I tried again with the above and it did give me output, then I changed it to whats shown below and no signals at all !

Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);
Plot crossover2 = if(rsi<50 and rsi[1[]>50,1,double.nan);



Last edited by ABCTG; August 1st, 2019 at 10:14 AM. Reason: Added code examples.
Follow me on Twitter Visit my Facebook Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
  #5 (permalink)
fertile
 
 
Posts: 1 since Aug 2019
Thanks: 1 given, 0 received

2 condition if

i just saw this, it might be the problem
rsi[1[]

change to
rsi[1]

----------------------------

maybe if this
Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);

is changed to this 50)
Plot crossover = if((rsi>50 and rsi[1]<50),1,double.nan);


but i've never used commas in thinkscript. i would write it this way
Plot crossover = if (rsi>50 and rsi[1]<50 ) then 1 else double.nan;

Reply With Quote
 
  #6 (permalink)
Legendary Market Wizard
Dallas, TX
 
Trading Experience: Intermediate
Platform: NT, TS
Broker/Data: IB, Oanda
Favorite Futures: ES, MES, MNQ, MYM
 
kareem40's Avatar
 
Posts: 557 since May 2010
Thanks: 1,040 given, 601 received


halcyonguy View Post
i just saw this, it might be the problem
rsi[1[]

change to
rsi[1]

----------------------------

maybe if this
Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);

is changed to this 50)
Plot crossover = if((rsi>50 and rsi[1]<50),1,double.nan);


but i've never used commas in thinkscript. i would write it this way
Plot crossover = if (rsi>50 and rsi[1]<50 ) then 1 else double.nan;

Just noticed, its for your first post and its a help, nice
Welcome,
K

Follow me on Twitter Visit my Facebook Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to kareem40 for this post:
 
  #7 (permalink)
Minneapolis Minnesota
 
 
Posts: 18 since Jul 2019
Thanks: 0 given, 7 received


kblaine123 View Post
I thought you could use 2 conditions within an If statement ?

Simple Example....RSI crossover signal

Plot crossover = if(rsi>50 and rsi[1[]<50,1,double.nan);

This does not work.....am I doing something wrong ? Or is it just not accepted, seems like I used it long ago but not working now.

Any help ? Thanks in advance

That's sort of an awkward way to write a crossing condition in Thinkscript. The language provides a slightly more intuitive way.

 
Code
 if rsi crosses above 50 then 1 else Double.NaN;

Reply With Quote

Reply



futures io > > > > > 2 conditions IF statement ?

« percentage | - »



Upcoming Webinars and Events (4:30PM ET unless noted)
 

futures io is celebrating 10-years w/ over $18,000 in prizes!

Right now
 

$1,000 in Amazon Gift Cards being given away right now from GFF Brokers

Right now
 

$250 Amazon Gift Cards with our "Thanks Contest" challenge!

Right now
 

Show us your trading desks and win over $5,000 in prizes w/Jigsaw Trading

August
 

Webinar: AutoTrading World Cup Advisor w/GFF Brokers

Aug 22
 

Webinar: Suri Duddella (TBA)

Elite only
 

Webinar: Richard Bailey (TBA)

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
RE Easylanguage statement for coding price baz111 EasyLanguage Programming 2 December 26th, 2011 10:07 AM
Boehner Caves On Payroll Tax: Official Statement Quick Summary News and Current Events 0 December 22nd, 2011 05:50 PM
Jefferies Re-Releases Statement Quick Summary News and Current Events 0 November 3rd, 2011 10:30 AM
NT7 audio alert - statement expected? subterfuge NinjaTrader Programming 2 March 17th, 2011 09:55 AM
Fed repurchase statement Snoop Traders Hideout 1 November 4th, 2010 07:11 AM


All times are GMT -4. The time now is 06:57 PM. (this page content is cached, log in for real-time version)

Copyright © 2019 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