[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [amibroker] Detecting when chart is not at right hand edge



PureBytes Links

Trading Reference Links

I hope I copied all of the code. This code changes the background to dark
blue when the rightmost bar is not the current bar (or you have selected
some other bar -- creating the same problem). It ALSO turns ORANGE when you
have no data for the current day, YELLOW when you have not received an RT
quote in the last 60 seconds and DARKRED when the volume is low (you must
define the variable "fairVolume" as you wish). Lastly, there is an Parameter
to change the ORANGE and YELLOW to more subdued colors when it really is
after hours and you want to see your chart!

 

//////////////////////// VOLUME BASED BACKGROUND COLOR WITH ALERTS

 

BgNormal = ColorHSB(60, 0, 0);     //Black background

BgRToff  = IIf(ParamToggle("R/T STOPPED
color","Yellow|Purple",0),ColorHSB(200,120,80),colorYellow); //When the R/T
feed has stopped

BgNoSig  = IIf(ParamToggle("R/T OFF
color","Orange|Purple",0),ColorHSB(200,100,60),colorOrange);     //No data
for current date

BgLowVol = ColorHSB(0, 255, 80);   //darkBrown background for low volume

BgSelect = ColorHSB(180, 200, 80); //medium blue background when selected
bar is not the most current bar

 

ProblemStatus = BgNormal;

LastRTQuote   = GetRTData("UpdateTime"); //Gets values directly from R/T
data source. Requires Professional version.

Currentime    = Now(4); //CPU time to the current minute adjusted to market
time.

printf("\nCurrent time is: %1.0f\nLast update was:    %1.0f\nDelta :
%06.0f\n\n",Currentime ,LastRTQuote, Currentime - LastRTQuote);

 

//Turn the background dark blue if the most recent date is not visible

if (LastValue(BarIndex()) != SelectedValue(BarIndex()) ) ProblemStatus =
(BgSelect);

 

//Turn the background Yellow if the selected symbol has no data for today
(it's not R/T).

else if (LastValue(DateNum()) != Now(3) ) ProblemStatus =
SelectedValue(BgNoSig);

 

//Turn the background orange if the most recent time of R/T quote is more
than 1 minute old (R/T has stopped)

else if (LastValue(DateNum()) == Now(3) AND LastRTQuote < Currentime - 100 )
ProblemStatus = (BgRToff); //Date is today, but time last quote is more than
1 minute old

 

//Turn the background dark red if Volume is below "fair" value

if (NOT SelectedValue(fairVolume)) ProblemStatus = (BgLowVol);

 

SetChartBkColor(ProblemStatus);

 

SetChartOptions(1, chartShowDates);

 

--

Terry

-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf
Of Wes Smith
Sent: Tuesday, January 23, 2007 14:23
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Detecting when chart is not at right hand edge

 

How would I tell in AFL if the chart has been scrolled back, and is not at
the right and edge showing the latest quote?
I've looked at bar/selected bar index etc... not quite sure what to look at.

tia

 


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.5/645 - Release Date: 1/22/2007 4:10 PM