W tym przypadku jeden obiekt nadpisywał drugi i przez to wyświetlana była tylko wartość.
Poniżej zamieszczam poprawiony kod. Zrobiłem tak, że tylko jeden obiekt jest tworzony i w nim jest nazwa + wartość.
Kod: Zaznacz cały
//+------------------------------------------------------------------+
//| InfoMarket.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property link "http://www.investsoft.pl"
extern color kolor = White;
extern int FontSize = 10;
extern string Spreadtekst="Spread =";
extern string Swaplongtekst="Swap long =";
extern string Swapshorttekst="Swap short =";
extern string Tickvaluetekst="Tick value =";
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
RefreshRates();
int spreadmarket=MarketInfo(Symbol(),MODE_SPREAD);
ObjectCreate("Spread",OBJ_LABEL,0,0,0);
ObjectSetText("Spread",Spreadtekst,FontSize ,"Arial Black",kolor);
ObjectSet("Spread",OBJPROP_XDISTANCE,5);
ObjectSet("Spread",OBJPROP_YDISTANCE,20);
double swaplongmarket=MarketInfo(Symbol(),MODE_SWAPLONG);
ObjectCreate("Swaplong",OBJ_LABEL,0,0,0);
ObjectSetText("Swaplong",Swaplongtekst,FontSize ,"Arial Black",kolor);
ObjectSet("Swaplong",OBJPROP_XDISTANCE,5);
ObjectSet("Swaplong",OBJPROP_YDISTANCE,35);
double swapshortmarket=MarketInfo(Symbol(),MODE_SWAPSHORT);
ObjectCreate("Swapshort",OBJ_LABEL,0,0,0);
ObjectSetText("Swapshort",Swapshorttekst,FontSize ,"Arial Black",kolor);
ObjectSet("Swapshort",OBJPROP_XDISTANCE,5);
ObjectSet("Swapshort",OBJPROP_YDISTANCE,50);
double tickvaluemarket=MarketInfo(Symbol(),MODE_TICKVALUE);
ObjectCreate("Tickvalue",OBJ_LABEL,0,0,0);
ObjectSetText("Tickvalue",Tickvaluetekst,FontSize ,"Arial Black",kolor);
ObjectSet("Tickvalue",OBJPROP_XDISTANCE,5);
ObjectSet("Tickvalue",OBJPROP_YDISTANCE,65);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectDelete("Spread");
ObjectDelete("Swaplong");
ObjectDelete("Swapshort");
ObjectDelete("Tickvalue");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
RefreshRates();
ObjectSetText("Spread", Spreadtekst+DoubleToStr(MarketInfo(Symbol(),MODE_SPREAD),0));
ObjectSetText("Swaplong",Swaplongtekst+DoubleToStr(MarketInfo(Symbol(),MODE_SWAPLONG),2));
ObjectSetText("Swapshort",Swapshorttekst+DoubleToStr(MarketInfo(Symbol(),MODE_SWAPSHORT),2));
ObjectSetText("Tickvalue",Tickvaluetekst+DoubleToStr(MarketInfo(Symbol(),MODE_TICKVALUE),2));
return(0);
}
//+------------------------------------------------------------------+