Download MetaTrader 5

Build 600 Scripts Require Incoming Tick?

To add comments, please log in or register
JPS1
244
JPS1  

Simple label create and delete code

CREATE PRICE LABEL

extern color UpperPrice = Blue;

int deinit() {
    return( 0 );
}

int start()
  {

   double CreateLabel = ObjectCreate("UPPER", OBJ_ARROW,0,TimeCurrent(),Bid,0);
                        ObjectSet("UPPER",OBJPROP_ARROWCODE,6); 
                        ObjectSet("UPPER",OBJPROP_COLOR,UpperPrice);
                        ObjectSet("UPPER",OBJPROP_WIDTH,4);
                        WindowRedraw();
   
//----
   return(0);
  }
//+------------------------------------------------------------------+


DELETE PRICE LABEL
int deinit() {
    return( 0 );
}

int start()
  {
       
 ObjectDelete( "UPPER");
 WindowRedraw();
 
//----
   return(0);
  }
//+------------------------------------------------------------------+

1. Drop Create Price Label onto chart ---- good!

2. Drop Delete Price Label onto chart ---- good!

3. Drop Create Price Label onto chart again (before next incoming price tick) ---- Label appears in objects list, but can't be seen on chart because it's given a price value of 0.

However, if one waits for NEW price tick or refreshes chart, it works, but then repeats above cycle again.

JPS1
244
JPS1  
Build 604, same thing. New tick needed :(
Wyatt
16
Wyatt  

Try OnStart() instead of start()

btw this is a guess, I've been coding for less then a week.

qjol
3243
qjol  
JPS:
Build 604, same thing. New tick needed :(

so fake a tick
Slava
Moderator
6918
Slava  

Thank you. There was a bug.

Fixed

JPS1
244
JPS1  
Thank you stringo !!! :)
To add comments, please log in or register