-
Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
Messages Editor
Forum rules and recommendations - General - MQL5 programming forum (2023) -
//| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { // Tick event handling code here } //+------------------------------------------------------------------+ //| Custom indicator calculation function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, …
Decide whether your code is an EA or an indicator. It can not be both.
-
ObjectCreate("swapShort", OBJ_TEXT, 0, 0, 0); ObjectSetInteger(0, "swapShort", OBJPROP_ANCHOR, ANCHOR_LEFT_UPPER);
Text objects are connected to a price and time. Labels are connected to an anchor point and offset. PICNIC.
- ANCHOR_LEFT_UPPER is not an anchor offset.
Before
void DisplaySwapLong() { double swapShort = SymbolInfoDouble(_Symbol, SYMBOL_SWAP_SHORT); ObjectCreate("swapShort", OBJ_TEXT, 0, 0, 0); ObjectSetInteger(0, "swapShort", OBJPROP_ANCHOR, ANCHOR_LEFT_UPPER); ObjectSetText("swapShort", DoubleToStr(swapShort), 20, "Arial", clrAqua); ObjectSet("swapShort", OBJPROP_CORNER, 2); ObjectSet("swapShort", OBJPROP_XDISTANCE, 100); ObjectSet("swapShort", OBJPROP_YDISTANCE, 200); } void DisplaySwapShort() { double swapLong = SymbolInfoDouble(_Symbol, SYMBOL_SWAP_LONG); //Print(swapLong); //Comment("Swap Long =", swapLong); ObjectCreate("swapLong", OBJ_TEXT, 0, 0, 0); ObjectSetInteger(0, "swapLong", OBJPROP_ANCHOR, ANCHOR_LEFT_UPPER); ObjectSetText("swapLong", DoubleToStr(swapLong), 20, "Arial", clrAntiqueWhite); ObjectSet("swapLong", OBJPROP_CORNER, 2); ObjectSet("swapLong", OBJPROP_XDISTANCE, 10); ObjectSet("swapLong", OBJPROP_YDISTANCE, 40); }
After
void DisplaySwapLong() { double swapShort = SymbolInfoDouble(_Symbol, SYMBOL_SWAP_SHORT); ObjectCreate("swapShort", OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, "swapShort", OBJPROP_ANCHOR, ANCHOR_LEFT_UPPER); ObjectSetText("swapShort", DoubleToStr(swapShort), 20, "Arial", clrAqua); ObjectSet("swapShort", OBJPROP_CORNER, 2); ObjectSet("swapShort", OBJPROP_XDISTANCE, 100); ObjectSet("swapShort", OBJPROP_YDISTANCE, 200); } void DisplaySwapShort() { double swapLong = SymbolInfoDouble(_Symbol, SYMBOL_SWAP_LONG); //Print(swapLong); //Comment("Swap Long =", swapLong); ObjectCreate("swapLong", OBJ_LABEL, 0, 0, 0); ObjectSetInteger(0, "swapLong", OBJPROP_ANCHOR, ANCHOR_LEFT_UPPER); ObjectSetText("swapLong", DoubleToStr(swapLong), 20, "Arial", clrAntiqueWhite); ObjectSet("swapLong", OBJPROP_CORNER, 2); ObjectSet("swapLong", OBJPROP_XDISTANCE, 10); ObjectSet("swapLong", OBJPROP_YDISTANCE, 40); }
Am I missing something?
ObjectSet
@Paul Anscombe,
I am using the documentation sir
For your reference here the link to the 2 functions that do excist
https://docs.mql4.com/objects/objectset
https://docs.mql4.com/objects/objectsettext
- docs.mql4.com
Two is not an appropriate enumeration. ObjectSetInteger → Object Properties - Objects Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Thank you for pointing that out
@Paul Anscombe,
I am using the documentation sir
For your reference here the link to the 2 functions that do excist
https://docs.mql4.com/objects/objectset
https://docs.mql4.com/objects/objectsettext
that is MT4 you have posted in the MT5 section....
https://docs.mql4.com/objects/objectset
https://docs.mql4.com/objects/objectsettext
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I can print the values and show it in a comment but OBJ_TEXT is not showing up at all
Am I missing something?