Forex



Go Back   Forex Trading > Training > Metatrader > Metatrader 4 mql 4 - Development course > Lessons
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 11-13-2005, 11:48 AM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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 Files
File Type: pdf lesson12.pdf (391.0 KB, 5850 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!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 11-15-2005, 04:48 PM
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, 3414 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
  #3 (permalink)  
Old 11-15-2005, 05:57 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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!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 11-19-2005, 05:45 PM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
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!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 11-21-2005, 01:47 AM
Techguy's Avatar
Junior Member
 
Join Date: Nov 2005
Posts: 26
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!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 11-21-2005, 07:11 AM
Administrator
 
Join Date: Sep 2005
Posts: 20,058
Blog Entries: 241
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!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 11-21-2005, 05:57 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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!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 11-23-2005, 09:11 AM
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!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 11-30-2005, 05:23 AM
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!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 11-30-2005, 06:52 PM
codersguru's Avatar
Senior Member
 
Join Date: Oct 2005
Posts: 994
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, 3231 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!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
lesson


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

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
Lesson 9 - Preprocessors codersguru Lessons 8 09-04-2009 08:58 PM
Lesson 2 - SYNTAX codersguru Lessons 12 08-08-2009 03:08 AM
Lesson 10 - Your First Indicator (Part1) codersguru Lessons 3 04-21-2009 03:52 AM
Lesson 17 - Your First Script codersguru Metatrader 4 mql 4 - Development course 0 01-05-2006 12:37 AM
Lesson 11 - Your First Indicator (Part2) codersguru Lessons 8 12-30-2005 03:20 PM


All times are GMT. The time now is 03:04 PM.



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