Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course
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
  #71 (permalink)  
Old 01-01-2009, 11:27 PM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
Question icustom question

I have been trying to make an indicator that only calls another indicator by icustom. I made this line of code;

double COG=iCustom(NULL,0,"COGpoint1",50,3000,0,true);

Ive tryed to put the line different places of the code and ive played about with the name of the double, I have been reading and reading lots of tutorials. I think that mabey i must put some thing at the start like number of buffers!? mabey it should not be a double?

as it stands i am getting errors when i compile;

'init' - comma or semicolon expected
'init' - expression on global scope not allowed

can someone please help me to understand this with any custom indicator? because I feel that the tutorials that I have read (and I beleve I have them all) have given me the line of code for icustom but it doesnt work simply by having the line on its own, I know it must be changed for each indicator but there are some things missing from the explanation.
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
  #72 (permalink)  
Old 01-02-2009, 12:31 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
Ive had a major attempt at this Im am quite proud of myself! I got some code from Codersguru, I changed it for an indicator. lol it looks good has no errors when compiling (first time ever!!!!!) but ... it makes metatrader "not responding" when you add it to a chart.
I changed all the names of the buffers of the indicators (from val1, val2, val3, val4. to value1, value2...etc) because i figured that they were interfearing with each other as i had a better look at the code Codersguru had made (he made a code for calling supertrend with icustom) he changed the names of the buffers so i thort that must be it, but no still not responding.

//+------------------------------------------------------------------+
//| COG call.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 CLR_NONE
#property indicator_color4 CLR_NONE
//---- buffers

double value1[];
double value2[];
double value3[];
double value4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Lime);
SetIndexBuffer(0,value1);

SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);
SetIndexBuffer(1,value2);

SetIndexStyle(2,DRAW_NONE);
SetIndexBuffer(2,value3);

SetIndexStyle(3,DRAW_NONE);
SetIndexBuffer(3,value4);

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();

//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;



while(pos>=0)

{
value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true);
value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true);
value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true);
value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true);
}
return(0);
}
//+------------------------------------------------------------------+
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
  #73 (permalink)  
Old 01-02-2009, 12:41 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
this is the thread where i got the code made by Codersguru;
http://www.forex-tsd.com/questions/3...-function.html

i noticed i left a part out of my code pos at the ends and pos--;

value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos);
value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos);
value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos);
value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos);

pos--;

lets try it!
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
  #74 (permalink)  
Old 01-02-2009, 12:54 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
LOL LOL LOLLLLLLL hahaha! oh my god

ok I have made progress I have half my indicator on the screen (only the red part of the indicator, lol wheres the green part?) this is the first thing i have ever got to half work though i cant beleve it hahaha! does any one konw what i have done wrong?
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
  #75 (permalink)  
Old 01-02-2009, 01:35 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
hmm i added numbers at the end 0,1,2,3 for experiment. i dont know why? but it has done something, now i have a flat red line and green!!!!

yay! its not right though, mabey worse this is strange! help me please someone... everyone is sleeping zzz zzz zzz except 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
  #76 (permalink)  
Old 01-02-2009, 01:38 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
Look this is what i did (in Bold):

value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0);
value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,1);
value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,2);
value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,3);
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
  #77 (permalink)  
Old 01-02-2009, 01:40 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
In fact, look at my code now!

//+------------------------------------------------------------------+
//| COG call.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 CLR_NONE
#property indicator_color4 CLR_NONE
//---- buffers

double value1[];
double value2[];
double value3[];
double value4[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string short_name;

//---- indicators
IndicatorBuffers(4);

SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1,Lime);
SetIndexBuffer(0,value1);

SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1,Red);
SetIndexBuffer(1,value2);

SetIndexStyle(2,DRAW_NONE);
SetIndexBuffer(2,value3);

SetIndexStyle(3,DRAW_NONE);
SetIndexBuffer(3,value4);

IndicatorDigits(Digits+2);


return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();

//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;



while(pos>=0)

{
value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0);
value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,1);
value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,2);
value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,3);

pos--;
}
return(0);
}
//+------------------------------------------------------------------+
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
  #78 (permalink)  
Old 01-02-2009, 02:04 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
i tryed putting

value1[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,0);
value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,1);
value3[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,2);
value4[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,pos,0,3);

now it has kept again only the red line wich is buffer 2 but it has now put higher up in the chart screen and it it still flat. crazy!?!?
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
  #79 (permalink)  
Old 01-02-2009, 02:09 AM
bamben's Avatar
Junior Member
 
Join Date: Nov 2008
Posts: 9
bamben is on a distinguished road
ahhhhh!!!

whats so special about buffer 2???
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
  #80 (permalink)  
Old 03-08-2009, 09:25 PM
Agilos's Avatar
Junior Member
 
Join Date: Jan 2008
Posts: 7
Agilos is on a distinguished road
I got icustom working, this thread helped alot. Im working on an EA but im learning as im doing it so its a lil slow. Is there a way stop the EA after one trade or even autoclose itself after entering one trade?

The problem is after it hits my take profit, if everything still points short, it re-enters.

Any help would be greatly appreciated....
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

Tags
icustom, icustom function, iCustom()


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
Easy iCustom and Alerts! codersguru Indicators - Metatrader 4 58 04-13-2009 09:30 AM
iCustom question .. yaniv_av Indicators - Metatrader 4 16 06-20-2008 05:37 PM
icustom maje Questions 24 12-05-2007 10:26 AM
I need help on creating an Icustom statement for my EA using this indicator as input! iscuba11 Expert Advisors - Metatrader 4 4 09-11-2006 08:18 PM
iCustom() problem billritz Indicators - Metatrader 4 5 08-23-2006 08:22 AM


All times are GMT. The time now is 08:00 AM.



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