Skip This Ad >>
 
Register
Forgotten your password?
The Facebook Platform
Forex-TSD - Powered by vBulletin
Loading search...
Advanced search
  • Home
  • Forums
    Free sections Exclusive sections All sections
  • Register
    Create new account
  • More Recent
    Latest Threads Today's Posts
  • Rankings
    Most popular threads this month Most popular threads created this month Most linked threads this month Most active users Most reputed users
  • Calendar
  • Advertising
  • Others
    Blogs Toolbar
  • Help
    Contact Us FAQ
  • Premium Forum
  • Home
  • Forum
  • Discussion Areas
  • Setup Questions
  • Can anyone figure out why this will not work right??

Thread: Can anyone figure out why this will not work right??



  • LinkBack
    • LinkBack URL LinkBack URL
    • About LinkBacks About LinkBacks
    •  
    • Bookmark & Share
    • Digg this Thread!
    • Add Thread to del.icio.us
    • Bookmark in Technorati
    • Tweet this thread
  • Thread Tools
    • Show Printable Version
    • Email this Page…
    • Subscribe to this Thread…
  • Display
    • Switch to Hybrid Mode
    • Switch to Threaded Mode
Results 1 to 5 of 5
1 1 Attachment(s)

  1. 08-23-2006 12:20 AM #1
    iscuba11's Avatar
    iscuba11
    iscuba11 is offline Senior Member
    Points: 52,685, Level: 34
    Level completed: 36%, Points required for next Level: 2,315
    Overall activity: 0%
    Join Date
    May 2006
    Location
    Houston
    Posts
    395
    Points
    52,685
    Level
    34
    Achievements:
    Recommendation First ClassVeteran500 Experience Points

    Question Can anyone figure out why this will not work right??

    if (UseHourTrade)

    {

    if(!(Hour()>=FromHourTrade1 && Hour()<=ToHourTrade1)) a=1;

    if(!(Hour()>=FromHourTrade2 && Hour()<=ToHourTrade2)) b=1;

    if(!(Hour()>=FromHourTrade3 && Hour()<=ToHourTrade3)) c=1;

    if(a==1 || b==1 || c==1)

    {

    Comment(
    "\n"," * SOLAR WIND EXPERT ADVISOR *",
    "\n",
    "\n", " - PROGRAM IN SLEEP CYCLE - ",
    "\n",
    "\n"," > NON-TRADING HOURS! <");

    return(0);
    }
    }

    It compiles ok, but even if the program is active during one of the sessions, it displays the PROGRAM IN SLEEP message. I do not know what to do to correct this??
    • Share
      • Share this post on
      • Digg
      • Del.icio.us
      • Technorati
      • Twitter
    Reply With Quote Reply With Quote

  2. 08-23-2006 07:29 AM #2
    cubesteak's Avatar
    cubesteak
    cubesteak is offline Senior Member
    Points: 10,161, Level: 12
    Level completed: 31%, Points required for next Level: 839
    Overall activity: 0%
    Join Date
    Jul 2006
    Location
    Southern California
    Posts
    160
    Points
    10,161
    Level
    12
    Achievements:
    Veteran500 Experience Points

    Talking Try this...

    Hello,

    I've seen MT4 be really funky in how it reads multiple if conditions, with !'s in there, etc. So, give this a try. I basically changed the logic to "positive" logic and spread out the If's a bit to make sure they are really ballanced. You also needed to zero out the comment when your conditions aren't met, else it stays there.

    HAHA! It could be as simple as your original logic works, but the comment just needed to be zeroed out when the condition wasn't met.

    Anyway, I also removed the "return (0)" since its not a function, so you don't need to "return" anything... Its probably left over from the rest of your code, so you'll probably need to add it back in.


    Seems to work fine for me now.

    If any of the hours inclusive of the range in the From and To variables are met, there is no comment.

    Outside of those hours, the comment is there.

    I'm assuming that's what you wanted?

    Cheers,
    Cubesteak



    Code:
    if (UseHourTrade)
    {
       int now = Hour();
       if (
    
             ( (now>=FromHourTrade1) ) &&
             ( (now<=ToHourTrade1) )
             
          ) a=1;
    
       
       if (
    
             ( (now>=FromHourTrade2) ) &&
             ( (now<=ToHourTrade2) )
             
          ) b=1;
    
    
       if (
    
             ( (now>=FromHourTrade3) ) &&
             ( (now<=ToHourTrade3) )
             
          ) c=1;
    
       if (
             (a!=1) &&
             (b!=1) &&
             (c!=1)
          )
       {
       Comment(
       "\n"," * SOLAR WIND EXPERT ADVISOR *",
       "\n",
       "\n", " - PROGRAM IN SLEEP CYCLE - ",
       "\n",
       "\n"," > NON-TRADING HOURS! <");
       }
       else Comment("");
    }
    • Share
      • Share this post on
      • Digg
      • Del.icio.us
      • Technorati
      • Twitter
    Reply With Quote Reply With Quote

  3. 08-23-2006 07:56 AM #3
    cubesteak's Avatar
    cubesteak
    cubesteak is offline Senior Member
    Points: 10,161, Level: 12
    Level completed: 31%, Points required for next Level: 839
    Overall activity: 0%
    Join Date
    Jul 2006
    Location
    Southern California
    Posts
    160
    Points
    10,161
    Level
    12
    Achievements:
    Veteran500 Experience Points

    Some more goodies...

    I've been meaning to make something like this for quite some time, and your question gave me the impetus.

    Here's an indicator based on the above code. Hours can be set in the code, or by the indicator settings window.

    I tried to make one that would use a separate window, but I forgot that comments only work on the main charts.

    If people are interested in that, I can make one that uses objects, rather than comments.



    Enjoy!

    -Cubesteak
    Attached Files
    • File Type: mq4 3FoldTradingHours.mq4 (2.7 KB, 33 views)
    • Share
      • Share this post on
      • Digg
      • Del.icio.us
      • Technorati
      • Twitter
    Reply With Quote Reply With Quote

  4. 08-24-2006 04:02 AM #4
    iscuba11's Avatar
    iscuba11
    iscuba11 is offline Senior Member
    Points: 52,685, Level: 34
    Level completed: 36%, Points required for next Level: 2,315
    Overall activity: 0%
    Join Date
    May 2006
    Location
    Houston
    Posts
    395
    Points
    52,685
    Level
    34
    Achievements:
    Recommendation First ClassVeteran500 Experience Points

    Smile A Friend coded this for me - Works great!!!

    if (UseHourTrade)

    {
    int a=0;
    int b=0;
    int c=0;

    if(!(Hour()>=FromHourTrade1 && Hour()<=ToHourTrade1)) a=1;

    if(!(Hour()>=FromHourTrade2 && Hour()<=ToHourTrade2)) b=1;

    if(!(Hour()>=FromHourTrade3 && Hour()<=ToHourTrade3)) c=1;

    if(a==1 && b==1 && c==1)

    {

    Comment(
    "\n"," * SOLAR WIND EXPERT ADVISOR *",
    "\n",
    "\n", " - PROGRAM IN SLEEP CYCLE - ",
    "\n",
    "\n"," > NON-TRADING HOURS! <");

    return(0);
    }
    }

    Note: Unfortunately, the solarwind indicator is useless to write an EA from - It repaints itself! All indicators that have ++ used in the logic loop are virtually useless to try to write an EA for, because they all repaint themselves and that messes up the EA timing and optimization. They may be ok visually, but they don't work well in an EA. Most indicators do repaint themselves. You must use an indicator that has -- in the logic loop, and even then other conditions can mess up a EA. This is why so many EA's end up not working!!!

    Dave
    <><<<
    Last edited by iscuba11; 08-24-2006 at 04:08 AM.
    • Share
      • Share this post on
      • Digg
      • Del.icio.us
      • Technorati
      • Twitter
    Reply With Quote Reply With Quote

  5. 08-24-2006 04:09 AM #5
    cubesteak's Avatar
    cubesteak
    cubesteak is offline Senior Member
    Points: 10,161, Level: 12
    Level completed: 31%, Points required for next Level: 839
    Overall activity: 0%
    Join Date
    Jul 2006
    Location
    Southern California
    Posts
    160
    Points
    10,161
    Level
    12
    Achievements:
    Veteran500 Experience Points
    Hmm.. You'll still need to do the Comment (""); or else the comment will never go away, unless you've reset it somewhere else.


    Quote Originally Posted by iscuba11
    if (UseHourTrade)

    {
    int a=0;
    int b=0;
    int c=0;

    if(!(Hour()>=FromHourTrade1 && Hour()<=ToHourTrade1)) a=1;

    if(!(Hour()>=FromHourTrade2 && Hour()<=ToHourTrade2)) b=1;

    if(!(Hour()>=FromHourTrade3 && Hour()<=ToHourTrade3)) c=1;

    if(a==1 && b==1 && c==1)

    {

    Comment(
    "\n"," * SOLAR WIND EXPERT ADVISOR *",
    "\n",
    "\n", " - PROGRAM IN SLEEP CYCLE - ",
    "\n",
    "\n"," > NON-TRADING HOURS! <");

    return(0);
    }
    }

    Note: Unfortunately, the solarwind indicator is useless to write an EA from - It repaints itself! All indicators that have ++ used in the logic loop are virtually useless to try to write an EA for, because they all repaint themselves and that messes up the EA timing and optimization. They may be ok visually, but they don't work well in an EA. Most indicators do repaint themselves. You must use an indicator that has -- in the logic loop, and even then other conditions can mess up a EA. This is why so many EA's end up not working!!!

    Dave
    <><<<
    • Share
      • Share this post on
      • Digg
      • Del.icio.us
      • Technorati
      • Twitter
    Reply With Quote Reply With Quote

1 1 Attachment(s)

Quick Navigation Setup Questions Top
  • Site Areas
  • Settings
  • Private Messages
  • Subscriptions
  • Who's Online
  • Search Forums
  • Forums Home
  • Forums
  • Announcements
    1. Announcements Blog
  • Exclusive Forum
    1. Elite Section
  • Forex Press
    1. Analytics
    2. Articles
    3. Success Stories
  • Discussion Areas
    1. General Discussion
    2. Metatrader 4
      1. Metatrader 3
    3. Metatrader 5
    4. Post and compare Trades
    5. Setup Questions
    6. Suggestions for Trading Systems
    7. Documentation
    8. Strategy Trader
  • Non Related Discussions
  • Downloads
    1. Indicators - Metatrader 4
      1. Indicators - Metatrader 3
      2. Indicators - Metatrader 5
    2. Manual trading systems
    3. Expert Advisors - Metatrader 4
      1. TSD Expert Advisors
      2. Expert Advisors - Metatrader 5
      3. Expert Advisors - Metatrader 3
    4. Tools and utilities
    5. Tools and utilities - Strategy Trader
  • Trading systems
    1. CatFx50
    2. Brain Systems
    3. Ema Cross
    4. Harmonic trading
    5. The "XO"-Method
    6. Phoenix
    7. Dolly
    8. Digital Filters
    9. Martingale/Average Cost and Hedging
  • Automated Trading
    1. News/Signal Trading
    2. FX Signals Marketplaces
  • Commercial systems
    1. Commercial Trading Systems and indicators
    2. Raw Commercial Ideas
    3. Evaluate Commercial Ideas
  • Brokers
    1. Metatrader brokers
  • Programming
    1. MetaTrader Programming
    2. TradeStation Programming
  • Training
    1. Metatrader
      1. Metatrader 4 mql 4 - Development course
        1. Questions
        2. Lessons
    2. TradeStation

» Popular Tags

analysis backtest best broker breakeven breakout broker close all orders script code data window day trading decompile ex4 ea ma ea zig zag ecn EQUITY EUR/USD eurusd exit strategies expert

» Rankings

Hottest Threads

1  Eurusd/gbpusd
2  CatFx50
3  10points 3.mq4
4  FxOpen
5  Multi Timeframe Indicators

view more
 

Most Popular Threads

1  Multi Timeframe In...
2  CatFx50
3  Something interesting pl...
4  The Murrey Math Trading System
5  Show Us Your Best

view more

» FEATURED BROKERS



« Previous Thread | Next Thread »

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Point and Figure Charting for MT4
    By omrangassan in forum Commercial Trading Systems and indicators
    Replies: 103
    Last Post: 04-28-2012, 05:10 PM
  2. Point & Figure charts
    By Marbo in forum Indicators - Metatrader 4
    Replies: 1
    Last Post: 02-14-2007, 11:06 AM
  3. Figure it out
    By jarcrocker in forum Expert Advisors - Metatrader 4
    Replies: 1
    Last Post: 01-24-2007, 02:24 PM
  4. Point and Figure charts
    By hua in forum Metatrader 4
    Replies: 2
    Last Post: 04-03-2006, 04:51 PM

Tags for this Thread

  • Point and Figure

View Tag Cloud

Bookmarks

Bookmarks
  • Submit to Digg Digg
  • Submit to del.icio.us del.icio.us
  • Submit to Technorati Technorati
  • Submit to Furl Furl
  • Submit to StumbleUpon StumbleUpon
  • Submit to Reddit Reddit
  • Submit to Facebook Facebook
  • Submit to Blink List Blink List
  • Submit to Google Google
  • Submit to Yahoo My Web Yahoo My Web
  • Submit to Twitter Twitter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  • BB code is On
  • Smilies are On
  • [IMG] code is On
  • [VIDEO] code is On
  • HTML code is Off
  • Trackbacks are On
  • Pingbacks are On
  • Refbacks are On

Forum Rules

Forums
  • Free sections
  • Exclusive sections
  • All sections
Calendar Social Networking
Premium Forum
  • Elite Membership
  • Advanced Membership
All times are GMT. The time now is 08:08 AM.
Terms and Conditions
PRIVACY POLICY
Powered by vBulletin® Version 4.1.11
Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Digital Point modules: Sphinx-based search

Subscribe today and get...

Elite Membership
  • Elite Trading Systems
  • Propietary Indicators
  • Private Performance Reports
  • Elite EAs Source Code
  • 24/5 Trading Support!
Advanced Membership
  • Elite benefits, plus:
  • - MT4 & MT5 cutting-edge indicators.
  • - Advanced propieatry indicators and its source codes.
  • - Free conversion of MT4 indicatiors to MT5.
View our best offer!