HELP!!!!!!!!!!!!!!! Newbie Where do I put this script????????????? - page 2

 
youngsequan:

Thank you so much

I see what I did wrong and now the price is on my charts.

Is there a way to have it where it will show just 1.3130 and not 1.3180800

Hopefully I can get rid of the last 3 numbers



Change this line . . .

ObjectSetText("Priceinfo", "Price: "+Bid);

 to this . . .

ObjectSetText("Priceinfo", StringConcatenate("Price: ", DoubleToStr(Bid, Digits) ) );

 and re-compile your code.

 

I just noticed it does NOT move with the price, is there a way to make it live


Thanks

 
youngsequan:

Thank you so much


I see what I did wrong and now the price is on my charts.


Is there a way to have it where it will show just 1.3130 and not 1.3180800

Hopefully I can get rid of the last 3 numbers


Thanks again


Alright, you need indicator. Do this :

Open MetaEditor (Press F4 from MetaTrader 4) > create new mql4 program press Ctrl + N > select indicator> click next > name your indicator > click next and do nothing > click finish > copy paste the code after start (see below) > Press F5 or F7 to compile it > press Ctrl + T to see if you have an error > if you have no error, the script is ready. 

Find int init() and add code so it will be like this :

string name = "Priceinfo";
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
  PlaySound ("wait.wav");
//----
   return(0);
  }

 Find int deinit and add code si it will be like this

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() 
  { 
//----
  ObjectDelete (name+1);
  ObjectDelete (name+2);
//----
  return(0);
  }

  Find int start() and add code so it will be like this

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
  ObjectCreate(name+1, OBJ_LABEL, 0, 100, 100);
  ObjectSetText(name+1, "Price Ask : "+DoubleToStr(Ask, Digits));
  ObjectSet(name+1,OBJPROP_XDISTANCE, 100);
  ObjectSet(name+1,OBJPROP_YDISTANCE, 50);
  ObjectSet(name+1,OBJPROP_FONTSIZE, 20);
  ObjectSet(name+1,OBJPROP_COLOR, White);
  WindowRedraw();
  
  ObjectCreate(name+2, OBJ_LABEL, 0, 100, 100);
  ObjectSetText(name+2, "Price Bid : "+DoubleToStr(Bid, Digits));
  ObjectSet(name+2,OBJPROP_XDISTANCE, 100);
  ObjectSet(name+2,OBJPROP_YDISTANCE, 25);
  ObjectSet(name+2,OBJPROP_FONTSIZE, 20);
  ObjectSet(name+2,OBJPROP_COLOR, White);
  WindowRedraw();
  
  return (0);
  }