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 Thread Tools Display Modes
  #1 (permalink)  
Old 11-13-2005, 10:48 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 12 - Your First Indicator (Part3)

Welcome to the third part of “Your First Indicator” lesson.
In the previous lesson we studied the code of our first indicator line by line and we reached the function dinit().

I hope you’ve came from the previous lessons with a clear idea about what we have done.

Today we are going to study start() function and its content. And –finally- we will compile and run our first Indicator.

Are you ready? Let’s hack the code line by line:

Why don't you download the lesson and enjoy? (I hope)
Attached Images
File Type: pdf lesson12.pdf (391.0 KB, 4038 views)
__________________
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
  #2 (permalink)  
Old 11-15-2005, 03:48 PM
Agent2005 Agent2005 is offline
Junior Member
 
Join Date: Nov 2005
Posts: 1
Agent2005 is on a distinguished road
won't show

Hi Guru!

First, thank you so much for all your FREE help!!!

Second, I seem to be having difficulty with the indicator. I cut and pasted the code directly into Meta Trader and it it isn't quite working.

If you don't mind, I've attached a picture of what I'm seeing.

Perhaps you might know why?

Agent2005
Attached Images
File Type: jpg tsd.JPG (171.3 KB, 1984 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-15-2005, 04:57 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
Unhappy Thanks!

Quote:
Originally Posted by Agent2005
Hi Guru!

First, thank you so much for all your FREE help!!!

Second, I seem to be having difficulty with the indicator. I cut and pasted the code directly into Meta Trader and it it isn't quite working.

If you don't mind, I've attached a picture of what I'm seeing.

Perhaps you might know why?

Agent2005
agent2005,

Thanks for your kind words!

1- Did you play around the options: Fixed Minimum & Fixed Maximum in the indicator property window?
The image you sent shows Min -900000 & Max 900000

2- Could I see the code you cut-pasted, why don't you download the indicator and compile it instead od cut-paste?
__________________
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-19-2005, 04:45 PM
newdigital newdigital is offline
Administrator
 
Join Date: Sep 2005
Posts: 15,138
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 a questions.
It was difficult for me to understand the logic but seems I got it.

1. int Counted_bars = IndicatorCounted ();
if (counted_bars > 0) counted_bars --;

It means that indicator is counting all the bars which was appeared on the chart.
counted_bars-- is minus 1 every time. So, it should be started from some maximum value.
Why it is counting like -- and not ++ (starting from zero and counted_bars ++?

2. if indicator is not counting the bars starting from zero we have pos = 0 in the beginning. Right?
int pos = Bars - counted_bars;
Because number of counted_bars is subtracted from the total numbers of the bar in the chart. And if counted_bar is started from zero, everything is ok. But counted_bars could not be started from zero because:
int Counted_bars = IndicatorCounted ();
if (counted_bars > 0) counted_bars --;

So, I do not understand something. May you explain?

3. What to write in the code if it is necessary for indicator to count already specified number of bars, 300 for example?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-21-2005, 12:47 AM
Techguy's Avatar
Techguy Techguy is offline
Junior Member
 
Join Date: Nov 2005
Posts: 22
Techguy is on a distinguished road
Question I have the same question

Quote:
Originally Posted by newdigital
I have a questions.
It was difficult for me to understand the logic but seems I got it.

1. int Counted_bars = IndicatorCounted ();
if (counted_bars > 0) counted_bars --;

It means that indicator is counting all the bars which was appeared on the chart.
counted_bars-- is minus 1 every time. So, it should be started from some maximum value.
Why it is counting like -- and not ++ (starting from zero and counted_bars ++?
I have the same question, because counted bars should equal the total number of bars. What if it is 3994 bars? and you subtract 1, then you have 3993 bars, but what you want is the current bar, bar [0], correct? How is decrementing the counted_bars by 1 going to use bar 0??
__________________
Kind Regards,

Techguy
Never Lose A Password
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-21-2005, 06:11 AM
newdigital newdigital is offline
Administrator
 
Join Date: Sep 2005
Posts: 15,138
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
It should be started from zero as I understand. Or from 1.
But according to this suggestion it is not started from zero, it was started from something, or from some max value may be:
if (counted_bars > 0) counted_bars --;

As Codersguru described before "pos" is the number of time for the loop to work.
Because:
int pos = Bars - counted_bars;

It means if counted_bars is equal to the total number of Bars in the charts the loop will be finished. So, counted_bars should be started from some miminum and finished with some maximum.

May be I do not understand something.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-21-2005, 04:57 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
Arrow Bars

Quote:
Originally Posted by newdigital
It should be started from zero as I understand. Or from 1.
But according to this suggestion it is not started from zero, it was started from something, or from some max value may be:
if (counted_bars > 0) counted_bars --;

As Codersguru described before "pos" is the number of time for the loop to work.
Because:
int pos = Bars - counted_bars;

It means if counted_bars is equal to the total number of Bars in the charts the loop will be finished. So, counted_bars should be started from some miminum and finished with some maximum.

May be I do not understand something.
I've written an appendix about the BARS, I hope it helps .
Appendix 1 - BARS
__________________
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
  #8 (permalink)  
Old 11-23-2005, 08:11 AM
barry barry is offline
Member
 
Join Date: Nov 2005
Posts: 48
barry is on a distinguished road
Further Lessons

Coders Guru,
This is a very good course, thank you very much. I never would have figured out all the information you have told us on my own.

Aside from checking back here every few days, how can I know when the next lesson is posted? Also, do you know how many lessons you intend to create?
Thanks,
Barry
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 11-30-2005, 04:23 AM
TheExponential TheExponential is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
TheExponential is on a distinguished road
Codesgure,

firstly I'd like to congratulate you for a job well done.

Since you are asking for feeback, I'd like to raise one. on your lesson 12, you defined the following:

double Volume[]
This function returns a double type value holds the average of the total amount of currency traded within a period of time, usually one day.
For example: Volume [0] will return this average for the current bar.

I'm not too sure if this is correct. Volume[0] normally means the first tick of the new bar. It's basically the first quote (or tick) at the beginning of new bar. For example, on an hourly chart, it's the first tick for the new hour.

I also thought initially that Volume is the quantity traded for the day (if it's a day chart); but it's nothing to do with that.

Cheers!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 11-30-2005, 05:52 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
Arrow

Quote:
Originally Posted by TheExponential
Codesgure,
I'm not too sure if this is correct. Volume[0] normally means the first tick of the new bar. It's basically the first quote (or tick) at the beginning of new bar. For example, on an hourly chart, it's the first tick for the new hour.
TheExponential,

Try this code (in any time frame) and tell me what did you get:

PHP Code:
int start()
  {
   
Alert("Current market volume = " DoubleToStr(Volume[0],0));
   return(
0);
  } 
Attached what I've got.
Attached Images
File Type: jpg volume.JPG (29.0 KB, 1739 views)
__________________
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
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 11 - Your First Indicator (Part2) codersguru Lessons 8 12-30-2005 02:20 PM
Lesson 2 - SYNTAX codersguru Lessons 7 12-18-2005 12:57 PM
Lesson 10 - Your First Indicator (Part1) codersguru Lessons 1 11-08-2005 11:17 PM


All times are GMT. The time now is 02:19 AM.