How should I draw repetive line on K lines graphic?

 

Now I have make a function which can draw line on K lines graphic as below:

int LineNo=0;
void iDrawLine(int myFirstTime,double myFirstPrice,int mySecondTime,double mySecondPrice)
{
 string myObjectName="Line"+LineNo;
 ObjectCreate(myObjectName,OBJ_TREND,0,myFirstTime,myFirstPrice,mySecondTime,mySecondPrice);
 ObjectSet(myObjectName,OBJPROP_COLOR,Red);
 ObjectSet(myObjectName,OBJPROP_STYLE,STYLE_DOT);
 ObjectSet(myObjectName,OBJPROP_WIDTH,2);
 ObjectSet(myObjectName,OBJPROP_BACK,false);
 ObjectSet(myObjectName,OBJPROP_RAY,false);
 }
 

 I call this function "iDrawLine()" in function "Start()" , and when the EA runs, I can get one line on K(5 minutes) lines graphic.

But I just can get only one, even after  50 minutes.

Now  I want to get lines one by one when the new K line has been completed one by one.

I mean when a new K line occur, the function "Start()" runs, and I should get a new line according to the updated K lines graphic.

In the fact ,it is not, so how i should adjust these functions to get my expected lines.

Thanks. 

 
vx0532:

Now I have make a function which can draw line on K lines graphic as below:

 I call this function "iDrawLine()" in function "Start()" , and when the EA runs, I can get one line on K(5 minutes) lines graphic.

But I just can get only one, even after  50 minutes.

Now  I want to get lines one by one when the new K line has been completed one by one.

I mean when a new K line occur, the function "Start()" runs, and I should get a new line according to the updated K lines graphic.

In the fact ,it is not, so how i should adjust these functions to get my expected lines.

Thanks. 

Where do you increment/change the value of the variable  LineNo  ?
 
RaptorUK:
Where do you increment/change the value of the variable  LineNo  ?


Ok. I get what i want when i modified the value of the variable LineNo.

Thanks a lot. 

Another question about "indicatorcoundted()" 

 when i run this function--(indicatorcounted()), and i use print() to show its return one time by one time.

But i always get its return "-1", why? 

 
vx0532:


Ok. I get what i want when i modified the value of the variable LineNo.

Thanks a lot. 

Another question about "indicatorcoundted()" 

 when i run this function--(indicatorcounted()), and i use print() to show its return one time by one time.

But i always get its return "-1", why? 

Doesn't the documentation give you the answer ?
 
RaptorUK:
Doesn't the documentation give you the answer ?



ok,Now i know

I use it in "EA",so there is something strange.

it is ok when use it in "custom indicators".

 
vx0532:


ok,Now i know

I use it in "EA",so there is something strange.

it is ok when use it in "custom indicators".

Yes, you cannot use Custom Indicator functions in scripts or EAs . . .

 

"A group of functions used at producing of custom indicators.


These functions cannot be used in experts and scripts." 

 
RaptorUK:

Yes, you cannot use Custom Indicator functions in scripts or EAs . . .

 

"A group of functions used at producing of custom indicators.


These functions cannot be used in experts and scripts." 


Ok, Thank u.

The same as "A group of functions used in experts and scripts  cannot be used at  producing of custom indicators". 

Yes?

I think we can confirm certain function should be used at  producing of custom indicators or in experts & scripts by checking "#property indicator_chart/seperate_window " 's existing or not.

Yes? 

 
vx0532:


Ok, Thank u.

The same as "A group of functions used in experts and scripts  cannot be used at  producing of custom indicators". 

Yes?

I think we can confirm certain function should be used at  producing of custom indicators or in experts & scripts by checking "#property indicator_chart/seperate_window " 's existing or not.

Yes? 

No  & No.
 
RaptorUK:
No  & No.

Shall I know what is the "Yes"?

 
vx0532:

Shall I know what is the "Yes"?

Most functions that can be used in Scripts/EAs can also be used in Indicators,  trading functions cannot.
 
RaptorUK:
Most functions that can be used in Scripts/EAs can also be used in Indicators,  trading functions cannot.



what about "I think we can confirm certain function should be used at producing of custom indicators or in experts & scripts by checking "#property indicator_chart/seperate_window " 's existing or not."?
Reason: