Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Lessons
Forex Forum Register FAQ Members List Calendar Search Today's Posts Mark Forums Read


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 11-06-2005, 07:17 AM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Wink Lesson 11 - Your First Indicator (Part2)

Hi folks,

I’m so sorry for the two days delay in posting my new lesson.
Here (in my country) there was a holiday (3 days). And every time I open the computer to write the lesson I hear the door ring. New visitor every 3 hours

Anyway, this is the lesson , I hope you enjoy it.
Attached Images
File Type: pdf lesson11.pdf (388.0 KB, 3991 views)
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm

Last edited by codersguru : 11-08-2005 at 11:06 PM. Reason: Updated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-07-2005, 07:55 AM
newdigital newdigital is offline
Administrator
 
Join Date: Sep 2005
Posts: 15,174
newdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud ofnewdigital has much to be proud of
I have the questions.

1. You described about
#property indicator_buffer 1
Why do we need this buffer? What is it?

2. We wrote:
double ExtMapBuffer1[]
And you described about arrays. As I understand we may use
int my_array [2] = {30, 70}
when
#property indicator_minimum 0
#property indicator_maximum 100
and we need to draw two horizontal lines (for example).
And if not 30 and 70. But 30.5 and 60.5 we will use double instead of int?

3. Why
double ExtMapBuffer1[] ?
Is it always ExtMapBuffer and we need just remember it?

4. int ExtCountedBars = 0
It means we are counting everything using curent zero bar. But in some cases we need to xalculate high or low for 300 bars for example.
Should we use
int ExtCountedBars = 300 ?
But if we need to change it from time to time we will use in property?
#property ????

Last edited by newdigital : 11-07-2005 at 08:06 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-07-2005, 04:23 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Thumbs up Great questions!

Hi newdigital,

Thank you very much for your GREAT questions.

Quote:
Originally Posted by newdigital
I have the questions.

1. You described about
#property indicator_buffer 1
Why do we need this buffer? What is it?
1- you misspelled the code #property indicator_buffers 1 (don't miss the s in buffer )
2- indicator_buffers is the number of memory allocated to draw your line(s). When you set the number (up to 8) you are telling MQL4: “Please allocate a memory buffer for me to draw my line”.
3- We need indicator_buffers when we need to draw lines.

Quote:
Originally Posted by newdigital
2. We wrote:
double ExtMapBuffer1[]
And you described about arrays. As I understand we may use
int my_array [2] = {30, 70}
when
#property indicator_minimum 0
#property indicator_maximum 100
and we need to draw two horizontal lines (for example).
And if not 30 and 70. But 30.5 and 60.5 we will use double instead of int?
You are right!

The data type of #property indicator_maximum & #property indicator_minimum is integer in the MQL4 guide. I forgot to mention that was wrong.
They actually are double. So, you can use something like that:
#property indicator_maximum 40.50
#property indicator_minimum 1.10

Quote:
Originally Posted by newdigital
3. Why
double ExtMapBuffer1[] ?
Is it always ExtMapBuffer and we need just remember it?
You can use any name you want. MQL4 wizard added this array and chose this name. It's good programming practice to leave it as it.

Quote:
Originally Posted by newdigital
4. int ExtCountedBars = 0
It means we are counting everything using curent zero bar. But in some cases we need to xalculate high or low for 300 bars for example.
Should we use
int ExtCountedBars = 300 ?
But if we need to change it from time to time we will use in property?
#property ????

1- You can use any value you want instead of 0.
2- ExtCountedBars is a variable not a property.
3- If you want to enable the user to change this value use:
extern int ExtCountedBars = 0;
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-08-2005, 11:09 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Lightbulb Lesson update!

Hi folks,

Please download the updated version of the lesson.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-20-2005, 10:23 PM
Techguy's Avatar
Techguy Techguy is offline
Junior Member
 
Join Date: Nov 2005
Posts: 22
Techguy is on a distinguished road
Quote:
Originally Posted by newdigital

4. int ExtCountedBars = 0
It means we are counting everything using curent zero bar. But in some cases we need to xalculate high or low for 300 bars for example.
Should we use
int ExtCountedBars = 300 ?
But if we need to change it from time to time we will use in property?
#property ????
The actually number of bars counted will be 301, correct?
Because 0 is counted as well.

<hr>
//---- indicators
SetIndexStyle(0,1, 5);
SetIndexBuffer(0,ExtMapBuffer1);
// Set the index number for the buffer.
string short_name = "My First Indicator is Running!";
IndicatorShortName (short_name);
// Indicator Short name places the name of the indicator in the upper left
// hand corner.
// This fuction has a return type of VOID. meaning it just does it's job and
// does not return any value to the calling function.

//34567891123456789212345678931234567894123456789512 3456789612345678971234567898 3456789912345678911234567892123456789312
// 80 and 132 Character ruler.

//----
return(1);
}

Question: why is return set to 1? Because the int Init () function returns a drawing object?
__________________
Kind Regards,

Techguy
Never Lose A Password

Last edited by Techguy : 11-20-2005 at 10:26 PM. Reason: Did not want to double post and I had a question
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-21-2005, 04:37 AM
Techguy's Avatar
Techguy Techguy is offline
Junior Member
 
Join Date: Nov 2005
Posts: 22
Techguy is on a distinguished road
Why is pos = 2? or 3?

Codersguru:

I added in this code and got this result:

if (counted_bars>0) counted_bars--;

int pos = Bars- counted_bars;
Print ("Bar index number is ", pos, ".");
// Bars is declared internally and equals the number of bars on the chart.

double dHigh , dLow, dResult; // a String of declarations.
Comment ("Hi, I'm here on the main Chart Window!");
// Prints a message in the top left corner of the chart.

The bar index number prints out as 2 , then 3, then 2,then 3??
Attached Images
File Type: jpg barcountmystery.JPG (48.4 KB, 1533 views)
__________________
Kind Regards,

Techguy
Never Lose A Password
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 12-19-2005, 05:00 PM
mcintyd1 mcintyd1 is offline
Junior Member
 
Join Date: Dec 2005
Location: Portland, Oregon, USA
Posts: 7
mcintyd1 is on a distinguished road
Smile Line by Line Teaching Method

Codersguru asked this in Lesson 11:
"How will we work?
We will write the line(s) of the code we are going to explain then we will explain them
afterwards, if there are no topics, we will explain the line(s) of code directly. But at the
most of the time we will pause to discuss some general topics.
I want to here your suggestion about this method please!"

The line-by-line explanations are an excellent technique, and it was fine to have the pauses to discuss general topics.

Thanks to Codersguru for this helpful tutorial!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 12-19-2005, 05:10 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Lightbulb Thanks!

Quote:
Originally Posted by mcintyd1
Codersguru asked this in Lesson 11:
"How will we work?
We will write the line(s) of the code we are going to explain then we will explain them
afterwards, if there are no topics, we will explain the line(s) of code directly. But at the
most of the time we will pause to discuss some general topics.
I want to here your suggestion about this method please!"

The line-by-line explanations are an excellent technique, and it was fine to have the pauses to discuss general topics.

Thanks to Codersguru for this helpful tutorial!
mcintyd1,

Thank you very much for your answer ! It's very helpful (& pleasant) comment.

I hope you enjoyed the lessons.
__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 12-30-2005, 02:20 PM
cardio cardio is offline
Senior Member
 
Join Date: Sep 2005
Location: St Louis, MO, USA
Posts: 176
cardio is an unknown quantity at this point
Where new Indicators are stored

Hi
I had a run around trying to figure out where new indicators are stored. Finally I saw it was in the navigation window under 'custom indicators' - I did not see this mentioned in the lessons 10 through 13 - maybe I missed it.

Thanks for the great tutorials and I hope u managed to get u're car fixed.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

LinkBacks (?)
LinkBack to this Thread: http://www.forex-tsd.com/lessons/263-lesson-11-your-first-indicator-part2.html
Posted By For Type Date
Forex Indicators With Explanation - Type Your Search Here This thread Refback 12-04-2007 10:20 PM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 12 - Your First Indicator (Part3) codersguru Lessons 23 05-15-2008 05:37 PM
Lesson 6 - Loops & Decisions (Part2) codersguru Lessons 1 05-18-2007 02:20 PM
Lesson 9 - Preprocessors codersguru Lessons 7 05-18-2006 08:26 PM
Lesson 17 - Your First Script codersguru Metatrader 4 mql 4 - Development course 0 01-04-2006 11:37 PM
Lesson 10 - Your First Indicator (Part1) codersguru Lessons 1 11-08-2005 11:17 PM


All times are GMT. The time now is 10:39 PM.