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

RE: [amibroker] Histogram centered around a non-zero value



PureBytes Links

Trading Reference Links




<SPAN 
class=817135213-05122003>Thanks for the idea Graham, I'd never thought of use 
styleCandle to do anything but OHLC. I modified your code to provide a variable 
threshold for the histogram without changing the actual values displayed, so the 
title readout is correct, and wrapped it up as a function.
<SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003>Check this out (watch for line wrap as 
usual):
<SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003>===========
<SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003>function PlotVariableHistogram(array, threshold, label, 
pos_color, neg_color) { xO = threshold; xC = 
array; xH = Max(xO, xC); xL = Min(xO, xC);
<SPAN 
class=817135213-05122003> color = IIf(array >= threshold, pos_color, 
neg_color); PlotOHLC(xO, xH, xL, xC, label, color, 
styleCandle);}
 
<SPAN 
class=817135213-05122003>r = RSI(14);//Plot(r, "RSI", 
colorBlue);
 
<SPAN 
class=817135213-05122003>thresh = Param("Threshold", 50, 0, 100, 
1);PlotVariableHistogram(r, thresh, "RSI", colorBrightGreen, 
colorRed); // use candle colors from prefs
<SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003>===========
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003>A pair of 
related questions, if anyone knows:
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003>- Is there any way to 
set the candlestick fill colors from AFL? Or are the colors from prefs always 
used?
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003>- Is there any way 
to find out or make use of the colors set in preferences for various things? 
Like we can use Prefs() to get various other numeric preference settings? The 
only thing I know of is to set all your prefs colors to some custom color, which 
can then be referenced as colorCustom1, colorCustom2, etc., but I was wondering 
if we could use the prefs settings directly, whether they were custom colors or 
not.
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003>Thanks,
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003> 
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003>Dave
<SPAN 
class=817135213-05122003><SPAN 
class=817135213-05122003> 
<BLOCKQUOTE 
>As 
  I said there may have been an error as I type it on the fly. I was 
  usingcandles to plot the histogram of RSI. This will use your candle set 
  coloursin preferences for the values.Here is the corrected code 
  xO = 0;xC = RSI(14) - 50;xH = Max(xO,xC);xL = 
  Min(xO,xC);PlotOHLC( xO,xH,xL,xC,"" , colorBlack, 
  styleCandle);Cheers,Graham<A 
  href="">http://groups.msn.com/asxsharetrading<A 
  href="">http://groups.msn.com/fmsaustralia 
  -----Original Message-----From: Dave Merrill 
  [mailto:dmerrill@xxxxxxx] Sent: Thursday, 4 December 2003 9:43 PMTo: 
  amibroker@xxxxxxxxxxxxxxxSubject: RE: [amibroker] Histogram centered 
  around a non-zero valueThanks for the ideas; the second one works 
  well. I rewrote it slightly likethis:r = RSI(14);Plot(r - 50, 
  "", colorwhite, stylehistogram);bgcolor = colorLightGrey;Plot(r, "", 
  bgcolor, stylehistogram+styleNoLabel+styleNoRescale);Does anyone know 
  if we can access the colors set up in preferences throughAFL? That'd be a 
  better way to go than hard coding the background color. Iknow about the 
  Prefs function, but as far as I can see, it doesn't includegetting back 
  preferred colors.I couldn't figure out what you were up to with your 
  first idea. Not what I'mlooking for as written, but maybe there's 
  something in there. Doesn't matterthough, since the second one works fine, 
  and is simpler too.Thanks again,Dave> There are 
  2 ways you could achieve this>> xO = 50;> xC = RSI(14) - 
  50;> xH = max(xO,xC);> xL = min(xO,xC);> PlotOHLC( 
  xO,xH,xL,xC,"" ,colorblue,stylecandle);>> Or>> 
  Plot( RSI(14)-50,"",colorwhite,stylehistogam);//your backghround > 
  colour Plot( RSI(14), "", colorblue, stylehistogram);>>> 
  I have just typed these out, hoping they work, but may have some typo > 
  errors>> Cheers,> Graham>>> What's 
  the easiest way to plot something that looks like a histogram, > but 
  has the bars extending up and down from some value other than > zero? 
  For instance, suppose you wanted to plot RSI above and below 50. > You 
  could subtract 50 and use a normal histogram, but that makes the > 
  readings in the title, tooltip and to the right of the graph 
  wrong.>> Is there a simple solution I'm not thinking 
  of?>> Thanks,>> 
  Dave------------------------ Yahoo! Groups Sponsor 
  ---------------------~--> BuyInk Cartridges or Refill Kits for your HP, 
  Epson, Canon or Lexmark Printerat MyInks.com. Free s/h on orders $50 or 
  more to the US & Canada.<A 
  href="">http://www.c1tracking.com/l.asp?cid=5511<A 
  href="">http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM---------------------------------------------------------------------~->Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at:<A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to <A 
  href="">http://docs.yahoo.com/info/terms/ 
  Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.