Lesson 11 - Your First Indicator (Part2)

 
Files:
lesson11.pdf  388 kb
 

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

 
 

Lesson update!

Hi folks,

Please download the updated version of the lesson.

 
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.


//---- 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.

//345678911234567892123456789312345678941234567895123456789612345678971234567898 3456789912345678911234567892123456789312

// 80 and 132 Character ruler.

//----

return(1);

}

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

 

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

Files:
 

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!

 

Thanks!

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.

 

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.