How to display marketinfo??

 

Dear all

I've made the following code:

//----

ObjectDelete("TERMNAME2");
ObjectCreate("TERMNAME2", OBJ_LABEL, 0, 0, 0);
ObjectSet ("TERMNAME2", OBJPROP_BACK, back);
ObjectSet ("TERMNAME2", OBJPROP_CORNER, corner);
ObjectSet ("TERMNAME2", OBJPROP_XDISTANCE, xdis + 520);
ObjectSet ("TERMNAME2", OBJPROP_YDISTANCE, ydis + 100);


ObjectDelete("POINT");
ObjectCreate("POINT", OBJ_LABEL, 0, 0, 0);
ObjectSet ("POINT", OBJPROP_BACK, back);
ObjectSet ("POINT", OBJPROP_CORNER, corner);
ObjectSet ("POINT", OBJPROP_XDISTANCE, xdis + 480);
ObjectSet ("POINT", OBJPROP_YDISTANCE, ydis + 120);

ObjectDelete("DIGITS");
ObjectCreate("DIGITS", OBJ_LABEL, 0, 0, 0);
ObjectSet ("DIGITS", OBJPROP_BACK, back);
ObjectSet ("DIGITS", OBJPROP_CORNER, corner);
ObjectSet ("DIGITS", OBJPROP_XDISTANCE, xdis + 480);
ObjectSet ("DIGITS", OBJPROP_YDISTANCE, ydis + 140);

ObjectDelete("SPREAD");
ObjectCreate("SPREAD", OBJ_LABEL, 0, 0, 0);
ObjectSet ("SPREAD", OBJPROP_BACK, back);
ObjectSet ("SPREAD", OBJPROP_CORNER, corner);
ObjectSet ("SPREAD", OBJPROP_XDISTANCE, xdis + 480);
ObjectSet ("SPREAD", OBJPROP_YDISTANCE, ydis + 160);

//----

ObjectDelete("TERMNAME2");
ObjectDelete("POINT");
ObjectDelete("DIGITS");
ObjectDelete("SPREAD");

//----

double m1=MarketInfo(NULL,MODE_POINT);
double m2=MarketInfo(NULL,MODE_DIGITS);
double m3=MarketInfo(NULL,MODE_SPREAD);

//----

string m0 = "MarketInfo";
string m1a = "POINT: " + m1;
string m2a = "DIGITS: " + m2;
string m3a = "SPREAD: " + m3;

//----

ObjectSetText("TERMNAME2", m0, FontSize, Font, FontColor);
ObjectSetText("POINT", m1a, FontSize, Font, FontColor);
ObjectSetText("DIGITS", m2a, FontSize, Font, FontColor);
ObjectSetText("SPREAD", m3a, FontSize, Font, FontColor);

//---------------------

However, all value shown on screen are zero after I've compiled it.

Do I use the wrong method or there is any syntax error in my code??

I just want to check those marketinfo on the screen, would anybody give me a hand?

Wing

 

change:

double m1=MarketInfo(Symbol(),MODE_POINT);
double m2=MarketInfo(Symbol(),MODE_DIGITS);
double m3=MarketInfo(Symbol(),MODE_SPREAD);

Add;

int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }


remove:

//----

ObjectDelete("TERMNAME2");
ObjectDelete("POINT");
ObjectDelete("DIGITS");
ObjectDelete("SPREAD");

//---- 
 
enotrek:

change:

Add;

int deinit()
  {
//----
   ObjectsDeleteAll();
//----
   return(0);
  }

remove:

hmm, what if other indicators draw objects too?
 
zzuegg:
hmm, what if other indicators draw objects too?


Sorry my bad, i'm in the clouds of ea programming when you don't use the charts at all.

indicator objects (if done correctly) should be redrawn, but objects placed manually will be deleted.


dear wing. instead of remove those lines, place them at deinit()

 
enotrek:


Sorry my bad, i'm in the clouds of ea programming when you don't use the charts at all.

indicator objects (if done correctly) should be redrawn, but objects placed manually will be deleted.


dear wing. instead of remove those lines, place them at deinit()



enotrek

I've made it, thank you so much!

wing

Reason: