• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 4:54am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 4:54am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

help with code for displaying weekly pivots 5 replies

New idea for displaying a chart 0 replies

Displaying Multi Line Text in the Chart Window 2 replies

Displaying text on graph 2 replies

Displaying multiple instrument on a single chart 2 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
Tags: Help displaying text on a chart
Cancel

Help displaying text on a chart

  • Post #1
  • Quote
  • First Post: Nov 23, 2014 6:18am Nov 23, 2014 6:18am
  •  jnfer
  • | Joined Mar 2012 | Status: Member | 112 Posts
Hi everyone..

I need help on displaying text on the chart.
example:
rule 1
rule 2
rule 3
etc

Quote
Disliked
//+------------------------------------------------------------------+
//| dtext.mq4 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- indicator buffers mapping

//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
//---
ObjectSetText("text_object","Hello world!",10,"Times New Roman",Green);
//--- return value of prev_calculated for next call
//+------------------------------------------------------------------+

on the left down corner
I've got error
Quote
Disliked
'ObjectSetText' - declaration without type dtext.mq4 26 4

Tutorial from here http://docs.mql4.com/objects/objectsettext

Can someone help?

Thanks
  • Post #2
  • Quote
  • Nov 23, 2014 6:23am Nov 23, 2014 6:23am
  •  FerruFx
  • Joined May 2007 | Status: MT4/MT5 EAs/Indicators/Alerts coder | 6,460 Posts
ObjectSetText(...) function is only the last part of the text displaying.

You must create it first with ObjectCreate(...) function.
MT4/MT5 EAs/Indicators/Alerts coder
 
 
  • Post #3
  • Quote
  • Nov 23, 2014 6:50am Nov 23, 2014 6:50am
  •  jnfer
  • | Joined Mar 2012 | Status: Member | 112 Posts
Quote
Disliked
//+------------------------------------ ------------------------------+
//| dtext.mq4 |
//| Copyright 2014, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------ ------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
//+------------------------------------ ------------------------------+
//| Custom indicator initialization function |
//+------------------------------------ ------------------------------+
int start()
{
ObjectCreate("ObjName", OBJ_LABEL, 0, 0, 0);
ObjectSetText("ObjName","your Text",7, "Verdana", Red);
}

error
'}' - not all control paths return a value

sorry this is my first time and have no idea.... or if someone has code example of displaying text on a chart?
thanks
 
 
  • Post #4
  • Quote
  • Last Post: Nov 23, 2014 7:10am Nov 23, 2014 7:10am
  •  Gumrai
  • Joined Oct 2012 | Status: Member | 1,959 Posts
int start() expects an integer to be returned. As you don't return a value you get the warning not all control paths return a value

You create a label, but you don't give it any x, y co-ordinates to place it on the chart
Please Do Not PM Me With Coding Enquiries
 
 
  • Platform Tech
  • /
  • Help displaying text on a chart
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • X
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • X

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023