• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:32am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:32am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Stupid question 1 reply

Stupid question 10 replies

Stupid Question about News Trading! 2 replies

Ok, so I am really feeling stupid... 2 replies

very stupid question but grrrrrrrrr!!!!!!!!! 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Really stupid question about conditional operators in 'for' cycle
Cancel

Really stupid question about conditional operators in 'for' cycle

  • Post #1
  • Quote
  • First Post: Mar 3, 2012 10:54am Mar 3, 2012 10:54am
  •  Pipsgeek
  • | Joined Dec 2011 | Status: Member | 132 Posts
What's the reason that it doesn't work? I always mess it up and it can't get out of the cycle, is that like coding 101 that you can't put if-else conditional operators in a cycle or am I doing something wrong?
  • Post #2
  • Quote
  • Mar 4, 2012 2:51am Mar 4, 2012 2:51am
  •  enivid
  • Joined Aug 2009 | Status: Member | 448 Posts
Seeing an example of your problem-code would help greatly.
 
 
  • Post #3
  • Quote
  • Mar 4, 2012 10:40am Mar 4, 2012 10:40am
  •  Pipsgeek
  • | Joined Dec 2011 | Status: Member | 132 Posts
Thanks for the reply. I'm not sure what the exact mistake was (I should've written down what it was...). I think it had either something to do with not using continue or not redefining an external int. Either way I fixed it myself, I do think alot of it is unneccisary though.
Inserted Code
   for (cnt=2; cnt<stopcandle; cnt++)
     {
      if (iClose(pair,chart,cnt) > iOpen(pair,chart,cnt) ) {bull = bull+1; continue;}
      else if (iClose(pair,chart,cnt) < iOpen(pair,chart,cnt) ) {bear = bear+1; continue;}
     }
If I think logically using continue here is unneccisary (although there's no point in continueing if the first condition returns true). I think stopcandle was a global/external value at first and once I redefined that before running the loop it was fixed.
 
 
  • Post #4
  • Quote
  • Last Post: Mar 4, 2012 2:13pm Mar 4, 2012 2:13pm
  •  CockeyedCowboy
  • Joined Apr 2006 | Status: Trader Keit | 286 Posts
this should work equally as well then.



Inserted Code
    for( cnt = 2; cnt < stopcandle; cnt ++ ) {
        if( iClose( pair, chart, cnt ) > iOpen( pair, chart, cnt ))
            bull = bull + 1;
        else if( iClose( pair, chart, cnt) < iOpen( pair, chart, cnt ))
            bear = bear + 1;
     }



Quoting Pipsgeek
Disliked
Thanks for the reply. I'm not sure what the exact mistake was (I should've written down what it was...). I think it had either something to do with not using continue or not redefining an external int. Either way I fixed it myself, I do think alot of it is unneccisary though.
Inserted Code
   for (cnt=2; cnt<stopcandle; cnt++)
     {
      if (iClose(pair,chart,cnt) > iOpen(pair,chart,cnt) ) {bull = bull+1; continue;}
      else if (iClose(pair,chart,cnt) < iOpen(pair,chart,cnt) ) {bear = bear+1; continue;}
     }
If I think logically using...
Ignored
Trader Keit ... Methods Of A Dirt Road Mad Man....
 
 
  • Platform Tech
  • /
  • Really stupid question about conditional operators in 'for' cycle
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023