Well, it sorta looks like the Comments for several indicators don't play well together. That is, my indicator displays a Comment (perhaps spaced down a few lines), and then -- when another indicator displays its Comment -- my Comment disappears.
Any ideas?
Hello,
Chart parameters measurement may be useful for text positioning:
int init()
{
static int ali.Digits ;
static double ald.QuotePoint ;
static int ali.TotalBars ;
static int ali.Resolution.H ;
static int ali.LastVisibleBar ;
static int ali.FirstVisibleBar ;
static int ali.TotalVisibleBars ;
static int ali.ShiftBars ;
static double ald.PriceMax ;
static double ald.PriceMin ;
static double ald.PriceRange ;
static int ali.Resolution.V ;
ali.Digits = MarketInfo ( Symbol () , MODE_DIGITS ) ;
ald.QuotePoint = MarketInfo ( Symbol () , MODE_POINT ) ;
ali.TotalBars = iBars ( Symbol () , Period () ) ;
ali.Resolution.H = WindowBarsPerChart () ;
ali.LastVisibleBar = WindowFirstVisibleBar () ;
if ( ali.LastVisibleBar < ali.Resolution.H )
ali.FirstVisibleBar = 0 ;
else ali.FirstVisibleBar = ali.LastVisibleBar - ali.Resolution.H + 1 ;
ali.TotalVisibleBars = ali.LastVisibleBar - ali.FirstVisibleBar + 1 ;
ali.ShiftBars = ali.Resolution.H - ali.TotalVisibleBars ;
ald.PriceMax = WindowPriceMax () ;
ald.PriceMin = WindowPriceMin () ;
ald.PriceRange = ald.PriceMax - ald.PriceMin ;
ali.Resolution.V = ald.PriceRange / ald.QuotePoint ;
Alert ( "" ) ;
Alert ( "ali.Resolution.H = " , ali.Resolution.H ) ;
Alert ( "ali.Resolution.V = " , ali.Resolution.V ) ;
Alert ( "Summary:" ) ;
Alert ( "" ) ;
Alert ( "ali.TotalBars = " , ali.TotalBars ) ;
Alert ( "ali.TotalVisibleBars = " , ali.TotalVisibleBars ) ;
Alert ( "ali.LastVisibleBar = " , ali.LastVisibleBar ) ;
Alert ( "ali.FirstVisibleBar = " , ali.FirstVisibleBar ) ;
Alert ( "ali.ShiftBars = " , ali.ShiftBars ) ;
Alert ( "Horizontal:" ) ;
Alert ( "" ) ;
Alert ( "ald.PriceRange = " , DoubleToStr ( ald.PriceRange , ali.Digits ) ) ;
Alert ( "ald.PriceMin = " , DoubleToStr ( ald.PriceMin , ali.Digits ) ) ;
Alert ( "ald.PriceMax = " , DoubleToStr ( ald.PriceMax , ali.Digits ) ) ;
Alert ( "Vertical:" ) ;
Alert ( "" ) ;
Alert ( "Chart Parameters:" ) ;
}
Ais.
Every Comment() call wipes out prior Comment() calls, yes.
There are two types of text objects you can draw. One uses pixels reference to window corners for positioning,
the other uses a time/price coordinate. Both support only single line of text per object.
To maintain our objects on the chart, including text objects, regular resetting and redrawing may be required:
ObjectsDeleteAll () ;
...
ObjectCreate (...
ObjectSet (...
ObjectSet (...
...
ObjectCreate (...
ObjectSet (...
ObjectSet (...
...
WindowRedraw () ;
-
Don't Hijack other threads for your off-topic post. Next time, make your own, new, thread.
-
Don't resurrect old threads without a very good reason. A lot has changed since Build 600 and Higher. (2014)
-
Perhaps you should read the manual. ChartGetString → ENUM_CHART_PROPERTY_STRING → CHART_COMMENT
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The Comments function draws a simple text line in the upper left hand corner of the chart -- sometimes even on top of another indicator's comments. How would I draw two lines, one beneath the other (as if there had been a carriage return)?
Or, said another way, "How do I position Comments on the chart?"