Forex



Go Back   Forex Trading > Programming > MetaTrader
Forex Forum Register More recent Blogs Calendar Advertising Others Help






Register
Welcome to Forex-TSD!, one of the largest Forex forums worldwide, where you will be able to find the most complete and reliable Forex information imaginable.

From the list below, select the forum that you want to visit and register to post, as many times you want. It’s absolutely free. Click here for registering on Forex-TSD.

Exclusive Forum
The Exclusive Forum is the only paid section. Once you subscribe, you will get free access to real cutting-edge Trading Systems (automated and not), Indicators, Signals, Articles, etc., that will help and guide you, in ways that you could only imagine, with your Forex trading.
  • Elite Section
    Get access to private discussions, specialized support, indicators and trading systems reported every week.
  • Advanced Elite Section
    For professional traders, trading system developers and any other member who may need to use and/or convert, the most cutting-edge exclusive indicators and trading systems for MT4 and MT5.
See more

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 09-23-2007, 11:50 PM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Driving me crazy

I'm trying to call the custom indicator CC_1. (attached)

Here's my code:

CC_USD=iCustom(NULL,0,"CC_1",0,0);
Print(" CC_USD =",CC_USD);
CC_EUR=iCustom(NULL,0,"CC_1",1,0);
Print(" CC_EUR =",CC_EUR);
CC_GBP=iCustom(NULL,0,"CC_1",2,0);
Print(" CC_GBP =",CC_GBP);
CC_CHF=iCustom(NULL,0,"CC_1",3,0);
Print(" CC_CHF =",CC_CHF);
CC_JPY=iCustom(NULL,0,"CC_1",4,0);
Print(" CC_JPY =",CC_JPY);
CC_AUD=iCustom(NULL,0,"CC_1",5,0);
Print(" CC_AUD =",CC_AUD);
CC_CAD=iCustom(NULL,0,"CC_1",6,0);
Print(" CC_CAD =",CC_CAD);
CC_NZD=iCustom(NULL,0,"CC_1",7,0);
Print(" CC_NZD =",CC_NZD);

In the experts file I keep getting this error:

CC_1 EURUSD,H1: unknown subwindow number -1 for ObjectCreate function

I'm not sure what's wrong.

My other problem is that it sometimes returns the proper info:
CC_EUR =0.0016

But a lot of the time the info returned is:
CC_EUR =2147483647

I can't figure out why it's returning this number. Could anyone who is better at this than me have a look and try to help? Thanks!
Attached Files
File Type: mq4 CC_1.mq4 (16.7 KB, 16 views)

Last edited by wolfe; 09-23-2007 at 11:52 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #2 (permalink)  
Old 09-24-2007, 05:24 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Not sure I'm better at this, but WindowFind - MQL4 Documentation
does tell you that -1 is what you get in the init() function....

Perhaps you should make a second init() function, to be called once from the start() function, and that second init() function (init2() maybe?) would include all the sl(..) calls.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #3 (permalink)  
Old 09-24-2007, 05:25 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
I've figured out that the indicator is working fine until a new bar is formed, then the indicator is stopping. Can someone look at the code in the first post and see if they can fix this? It doesn't seem to be continuing when a new bar is formed.

Thank you to anyone that can help!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #4 (permalink)  
Old 09-24-2007, 05:28 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist View Post
Not sure I'm better at this, but WindowFind - MQL4 Documentation
does tell you that -1 is what you get in the init() function....

Perhaps you should make a second init() function, to be called once from the start() function, and that second init() function (init2() maybe?) would include all the sl(..) calls.
Thanks for the reply. I'm not exactly sure how to fix the problem, but I will try your suggestion.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #5 (permalink)  
Old 09-24-2007, 05:41 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
I was thinking a design like the following outline....
PHP Code:
bool inited false;
int init()
{
    .... 
// As before but all sl(..) calls moved to init2()
    
inited false;
}

void init2()
{
    if ( 
inited ) return;
    ... 
// All the sl(..) calls
    
inited true;
}

int start()
{
    
init2();
    ...

In that way, the WindowFind() function would not be called from the init() function but from the start() function, at which time it actually works.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #6 (permalink)  
Old 09-24-2007, 05:56 AM
ralph.ronnquist's Avatar
Senior Member
 
Join Date: Oct 2006
Posts: 297
ralph.ronnquist is on a distinguished road
Quote:
Originally Posted by wolfe View Post
I've figured out that the indicator is working fine until a new bar is formed, then the indicator is stopping. Can someone look at the code in the first post and see if they can fix this? It doesn't seem to be continuing when a new bar is formed.

Thank you to anyone that can help!
Check the logic for "limit"...

As it currently stands: apart from at the first start() call, the counted_bars value will always be in the vicinity of Bars, while All_Bars by the looks of it remains 10, and therefore limit becomes a large negative number.

Maybe you wanted
PHP Code:
limit MathMinAll_BarsBars counted_bars); 
or something similar?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #7 (permalink)  
Old 09-24-2007, 06:42 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Quote:
Originally Posted by ralph.ronnquist View Post
Check the logic for "limit"...

As it currently stands: apart from at the first start() call, the counted_bars value will always be in the vicinity of Bars, while All_Bars by the looks of it remains 10, and therefore limit becomes a large negative number.

Maybe you wanted
PHP Code:
limit MathMinAll_BarsBars counted_bars); 
or something similar?
Thank you for your suggestions, I am going to change All_Bars to 0 and try your limit logic in place of what is currently there. I hope this will solve the problem. Thank you for taking your time to try and help me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #8 (permalink)  
Old 09-25-2007, 02:01 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Ralph,

Your suggestions seem to have done the trick! Thank you for spending your time to help another. The indicator is now staying current with the current bar. I hope someday to be able to repay the favor. I've posted the working indicator for all who are interested.

Thanks again!
Attached Files
File Type: mq4 CC_1.mq4 (16.8 KB, 29 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #9 (permalink)  
Old 09-25-2007, 03:39 AM
ElectricSavant's Avatar
Senior Member
 
Join Date: Jun 2007
Posts: 3,354
ElectricSavant is on a distinguished road
How do you read it?


Quote:
Originally Posted by wolfe View Post
Ralph,

Your suggestions seem to have done the trick! Thank you for spending your time to help another. The indicator is now staying current with the current bar. I hope someday to be able to repay the favor. I've posted the working indicator for all who are interested.

Thanks again!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
  #10 (permalink)  
Old 09-25-2007, 05:04 AM
wolfe's Avatar
Senior Member
 
Join Date: Jan 2006
Posts: 818
wolfe is on a distinguished road
Quote:
Originally Posted by ElectricSavant View Post
How do you read it?
Still experimenting with it. I want to incorporate it into an EA. Info about how it works can be found here.

Theoretical Basis of Building Cluster Indicators for FOREX - MQL4 Articles

Last edited by wolfe; 09-25-2007 at 05:08 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!StumbleUpon this Post!Reddit this Post!Facebook this Post!BlinkList this Post!Google Bookmarks this Post!Yahoo! My Web this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
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
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Documents Bureau-crazy in live account opening mpforex Metatrader brokers 4 04-12-2007 10:10 AM
invalid stop driving me nuts caldolegare Expert Advisors - Metatrader 4 11 05-04-2006 09:03 PM
Crazy Expert hosein9f Expert Advisors - Metatrader 4 10 03-09-2006 12:16 PM


All times are GMT. The time now is 05:04 AM.



Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.