• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 7:12pm
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 7:12pm
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

Help for Newbies (Discussion Thread) 675 replies

What most newbies must go through when trading Forex 85 replies

Help for Newbies. What can you learn on Forex Factory? 42 replies

Price Action for Newbies HELP WANTED! 2 replies

HELP THE NEWBIES!!!!! 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 1
Attachments: No Help for newbies at Forex-tsd :C
Exit Attachments
Tags: No Help for newbies at Forex-tsd :C
Cancel

No Help for newbies at Forex-tsd :C

  • Post #1
  • Quote
  • First Post: Edited 5:30am Jan 6, 2009 5:07am | Edited 5:30am
  •  bamben
  • | Commercial Member | Joined Nov 2008 | 102 Posts

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.


01-02-2009, 12:31 AM






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 icustomhe 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 |
//+------------------------------------------------------------------+


//---- 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);
}
//+------------------------------------------------------------------+


01-02-2009, 12:41 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

this is the thread where i got the code made by Codersguru;
iCustom function

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!


01-02-2009, 12:54 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

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?

http://i31.photobucket.com/albums/c3..._m/cogcall.jpg

#75 (permalink)
01-02-2009, 01:35 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

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!!!!
http://i31.photobucket.com/albums/c3...cogcall2-1.jpg
yay! its not right though, mabey worse this is strange! help me please someone... everyone is sleeping zzz zzz zzz except me!



01-02-2009, 01:38 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

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);



01-02-2009, 01:40 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

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);
}
//+------------------------------------------------------------------+



01-02-2009, 02:04 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

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!?!?


01-02-2009, 02:09 AM

bamben
Junior Member

Join Date: Nov 2008
Posts: 9

ahhhhh!!!

whats so special about buffer 2???
  • Post #2
  • Quote
  • Edited 5:36am Jan 6, 2009 5:20am | Edited 5:36am
  •  bamben
  • | Commercial Member | Joined Nov 2008 | 102 Posts
sorry this is now unreadable, i am fixing it now.....

I have fixed it!

I had all sorts of [font] code for different font styles littered on every line of my post.
 
 
  • Post #3
  • Quote
  • Jan 9, 2009 3:50am Jan 9, 2009 3:50am
  •  bamben
  • | Commercial Member | Joined Nov 2008 | 102 Posts
Wow, and no help here it seams eather! It is a shame I am seriously giving my best effort to learn and I was told that people here will help if you have a question or need a little guidence. where is forex flash when I need him some one please HEYELP!!! (help like penelope pitstop says) I need super man or spider man...ahhh
 
 
  • Post #4
  • Quote
  • Jan 9, 2009 4:21am Jan 9, 2009 4:21am
  •  yuhu
  • | Joined Jun 2007 | Status: Member | 117 Posts
I am not good at programming, but I think you should also post the custom indicator that you are calling 'COGpoint1'


That way, may be people would be able to help you.
Why do people only post a nice trending period chart?
 
 
  • Post #5
  • Quote
  • Jan 9, 2009 1:37pm Jan 9, 2009 1:37pm
  •  bamben
  • | Commercial Member | Joined Nov 2008 | 102 Posts
Thank you for the advice, I did not think of that! This Indicator is my baby. It is not finished yet, when It is compleated It will be something like the ZUP_v64 indicator.
http://i31.photobucket.com/albums/c3...Gpnextstep.jpg

In my Design the indicator has two extra features:
The first is a Zigzag stacked on cogpoint1 (zz).
Secondly the will be chart objects showing ONLY LowerHighs & HigherLows (D).

If any one would have any other idears for this I would like to here them. by all means have a go at making the changes any updates to this indicator will be posted here.


PS: the Cog point1 has two blue dots wich anaylise the trajectory based apon the angle of the first dot placed on the current bar of the indicator in relation to the second wich is steped back a few bars.
I am considering making the position of the second dot customisable in the Inputs menu also. In the future It may also be optional for a second set of dots (giving further backing to the prediction) buy drawing a second line from bars further back.
 
 
  • Post #6
  • Quote
  • Jan 9, 2009 1:45pm Jan 9, 2009 1:45pm
  •  bamben
  • | Commercial Member | Joined Nov 2008 | 102 Posts
Download Cog point1
Attached File(s)
File Type: mq4 COGpoint1.mq4   6 KB | 415 downloads
 
 
  • Post #7
  • Quote
  • Edited 2:22pm Jan 9, 2009 1:51pm | Edited 2:22pm
  •  thatwasme
  • Joined Feb 2008 | Status: Member | 403 Posts
I believe your iCustom calls are in the wrong format.
you have

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

iCustome works like this

double iCustom( string symbol, int timeframe, string name, ..., int mode, int shift)
Calculates the specified custom indicator and returns its value.
The custom indicator must be compiled (*.EX4 file) and be in the terminal_directoryexpertsindicators directory. Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart
timeframe. name - Custom indicator compiled program name. ... - Parameters set (if necessary). The passed parameters and their order must correspond with the desclaration order and the type of
extern variables of the custom indicator. mode - Line index. Can be from 0 to 7 and must correspond
with the index used by one of SetIndexBuffer functions. shift - Index of the value taken from the
indicator buffer (shift relative to the current bar the given amount of periods ago).

Sample:
double val=iCustom(NULL, 0, "SampleInd",13,1,0);

So the first field is the currency pair
2nd the timeframe 0 = current time frame
3rd the name of the file in "MyIndicator"
4th each of the paramaters in the same order for every external varable in your indicator you are calling. Each must be seperated by a comma in your case it looks like there are 4 external variables.
5th this is the tricky one. mode means the index buffer you want the data to come from you have 4 index buffers that are 0 1 2 3 so if you want the data from val1 you would enter 0 here val2 would be a 1 val3 would be a 2 val4 would be a 3 total of 4 indexbuffers.
6th this is the bar you want the data to begin to be retreived from.



CORRECTION I just saw above in your code you are using the variable pos for the shift so it looks like this
So it would be something like this if you want the data from val1

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


if you wanted the data from val2 it would be

double value2[pos]=iCustom(NULL,0,"COGpoint1",50,3000,0,true,1,pos);


And so on
 
 
  • Post #8
  • Quote
  • Jan 9, 2009 5:03pm Jan 9, 2009 5:03pm
  •  bamben
  • | Commercial Member | Joined Nov 2008 | 102 Posts
Great, I love you...can I have a kiss? lol hahahah!!!
 
 
  • Post #9
  • Quote
  • Last Post: Edited 6:14pm Jan 9, 2009 5:51pm | Edited 6:14pm
  •  thatwasme
  • Joined Feb 2008 | Status: Member | 403 Posts
Quoting bamben
Disliked
Great, I love you...can I have a kiss? lol hahahah!!!
Ignored
Hmmm, depends on what a bamben is.

Over in the Lounge forum in some eurusd thread, they're rafflen off dead donkeys, so I gotta be careful round here.
 
 
  • Platform Tech
  • /
  • No Help for newbies at Forex-tsd :C
  • 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