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

Re: [amibroker] Graph plots using loops



PureBytes Links

Trading Reference Links




Great plot! One problem I have is that on many charts I show a 
green 'nobbly' line at zero (see attached). This compresses the rest of the 
chart. Is there a way to avoid this? I couldn't see anything obvious in the 
code.
 
Thanks,
 
Steve
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Listes 
  trading 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">AmiBroker 
  Sent: Wednesday, April 30, 2003 9:43 
  AM
  Subject: [amibroker] Graph plots using 
  loops
  
  <SPAN 
  class=707444008-30042003>Hello
  <SPAN 
  class=707444008-30042003> 
  Here is a 
  simple code that uses a "for" loop to plot last supports, 
  resistances and open gaps on a candlestick chart.
  <SPAN 
  class=707444008-30042003> 
  <FONT 
  color=#0000ff size=2>
  Bars = param<FONT color=#0000ff 
  size=2>("Bars"<FONT color=#0000ff 
  size=2>,50<FONT color=#0000ff 
  size=2>,10<FONT color=#0000ff 
  size=2>,500<FONT color=#0000ff 
  size=2>,10<FONT color=#0000ff 
  size=2>);
  NN = param<FONT color=#0000ff 
  size=2>("Number of items to 
  plot",<FONT color=#282828 
  size=2>5,<FONT color=#282828 
  size=2>5,<FONT color=#282828 
  size=2>100,<FONT color=#282828 
  size=2>1);
  pc = 5<FONT color=#0000ff 
  size=2>*LastValue<FONT color=#0000ff 
  size=2>((HHV<FONT color=#0000ff 
  size=2>(H<FONT color=#0000ff 
  size=2>,Bars)-LLV<FONT color=#0000ff 
  size=2>(L<FONT color=#0000ff 
  size=2>,Bars))/MA<FONT color=#0000ff 
  size=2>(C<FONT color=#0000ff 
  size=2>,Bars));
  x0 = LastValue<FONT color=#0000ff 
  size=2>(Cum<FONT color=#0000ff 
  size=2>(1<FONT color=#0000ff 
  size=2>));
  Colorgapup = colorGreen<FONT 
  color=#0000ff size=2>;
  Colorgapdown = colorRed<FONT 
  color=#0000ff size=2>;
  Colorsupport = colorSeaGreen<FONT 
  color=#0000ff size=2>;
  Colorresistance = <FONT color=#ff0000 
  size=2>colorLightOrange;<FONT 
  color=#ff0000 size=2>
  title = <FONT color=#ff00ff 
  size=2>"Candlestick chart with supports, resistances and open gaps / 
  "+ <FONT color=#3cb371 
  size=2>fullname();<FONT 
  color=#ff0000 size=2>
  graphxspace = <FONT color=#282828 
  size=2>1;<FONT color=#3cb371 
  size=2>
  plot(<FONT color=#ff0000 
  size=2>C,<FONT color=#ff00ff 
  size=2>"",<FONT color=#ff0000 
  size=2>colorblack,<FONT color=#ff0000 
  size=2>stylecandle);<FONT 
  color=#3cb371 size=2>
  plot(<FONT color=#3cb371 
  size=2>bbandbot((<FONT color=#ff0000 
  size=2>H+<FONT color=#ff0000 
  size=2>L)/<FONT color=#282828 
  size=2>2,<FONT color=#282828 
  size=2>20,<FONT color=#282828 
  size=2>2),<FONT color=#ff00ff 
  size=2>"",<FONT color=#ff0000 
  size=2>colorlightblue,<FONT 
  color=#ff0000 size=2>stylenolabel<FONT color=#0000ff 
  size=2>);
  plot(<FONT color=#3cb371 
  size=2>bbandtop((<FONT color=#ff0000 
  size=2>H+<FONT color=#ff0000 
  size=2>L)/<FONT color=#282828 
  size=2>2,<FONT color=#282828 
  size=2>20,<FONT color=#282828 
  size=2>2),<FONT color=#ff00ff 
  size=2>"",<FONT color=#ff0000 
  size=2>colorlightblue,<FONT 
  color=#ff0000 size=2>stylenolabel<FONT color=#0000ff 
  size=2>);
  for(i=<FONT color=#282828 
  size=2>1; i<NN+<FONT color=#282828 
  size=2>1; i++)
  {
  // Resistances
  yb = LastValue<FONT color=#0000ff 
  size=2>(Trough<FONT color=#0000ff 
  size=2>(L<FONT color=#0000ff 
  size=2>,pc,i));
  xb = LastValue<FONT color=#0000ff 
  size=2>(TroughBars<FONT color=#0000ff 
  size=2>(L<FONT color=#0000ff 
  size=2>,pc,i));
  resistance = IIf<FONT 
  color=#0000ff size=2>(Cum<FONT 
  color=#0000ff size=2>(1<FONT 
  color=#0000ff size=2>)>=x0-xt+<FONT color=#282828 
  size=2>1,yt,-<FONT color=#282828 
  size=2>1e10);<FONT 
  color=#a52a00 size=2>
  // Supports
  yt = LastValue<FONT color=#0000ff 
  size=2>(Peak<FONT color=#0000ff 
  size=2>(H<FONT color=#0000ff 
  size=2>,pc,i));
  xt = LastValue<FONT color=#0000ff 
  size=2>(PeakBars<FONT color=#0000ff 
  size=2>(H<FONT color=#0000ff 
  size=2>,pc,i));
  support = IIf<FONT color=#0000ff 
  size=2>(Cum<FONT color=#0000ff 
  size=2>(1<FONT color=#0000ff 
  size=2>)>=x0-xb+1<FONT 
  color=#0000ff size=2>,yb,-1e10<FONT 
  color=#0000ff size=2>);
  // Open gaps up
  xgapup = LastValue<FONT 
  color=#0000ff size=2>(ValueWhen<FONT 
  color=#0000ff size=2>(GapUp<FONT 
  color=#0000ff size=2>(),Cum<FONT 
  color=#0000ff size=2>(1<FONT 
  color=#0000ff size=2>),i));
  ygapup = LastValue<FONT 
  color=#0000ff size=2>(ValueWhen<FONT 
  color=#0000ff size=2>(GapUp<FONT 
  color=#0000ff size=2>(),Ref<FONT 
  color=#0000ff size=2>(H<FONT 
  color=#0000ff size=2>,-1<FONT 
  color=#0000ff size=2>),i));
  ygapup = IIf<FONT color=#0000ff 
  size=2>(LastValue<FONT color=#0000ff 
  size=2>(LLV<FONT color=#0000ff 
  size=2>(L<FONT color=#0000ff 
  size=2>,x0-xgapup+1<FONT 
  color=#0000ff size=2>))<=ygapup,-<FONT color=#282828 
  size=2>1e10,ygapup);
  ygapup = IIf<FONT color=#0000ff 
  size=2>(Cum<FONT color=#0000ff 
  size=2>(1<FONT color=#0000ff 
  size=2>)>=xgapup,ygapup,-1e10<FONT 
  color=#0000ff size=2>);
  // Open gaps down
  xgapdn = LastValue<FONT 
  color=#0000ff size=2>(ValueWhen<FONT 
  color=#0000ff size=2>(GapDown<FONT 
  color=#0000ff size=2>(),Cum<FONT 
  color=#0000ff size=2>(1<FONT 
  color=#0000ff size=2>),1<FONT 
  color=#0000ff size=2>));
  ygapdn = LastValue<FONT 
  color=#0000ff size=2>(ValueWhen<FONT 
  color=#0000ff size=2>(GapDown<FONT 
  color=#0000ff size=2>(),Ref<FONT 
  color=#0000ff size=2>(L<FONT 
  color=#0000ff size=2>,-1<FONT 
  color=#0000ff size=2>),1<FONT 
  color=#0000ff size=2>));
  ygapdn = IIf<FONT color=#0000ff 
  size=2>(LastValue<FONT color=#0000ff 
  size=2>(HHV<FONT color=#0000ff 
  size=2>(H<FONT color=#0000ff 
  size=2>,x0-xgapdn +1<FONT 
  color=#0000ff size=2>))>=ygapdn ,-<FONT color=#282828 
  size=2>1e10,ygapdn );
  ygapdn = IIf<FONT color=#0000ff 
  size=2>(Cum<FONT color=#0000ff 
  size=2>(1<FONT color=#0000ff 
  size=2>)>=xgapdn ,ygapdn ,-<FONT color=#282828 
  size=2>1e10);<FONT 
  color=#a52a00 size=2>
  // Graph plots
  Plot<FONT color=#0000ff 
  size=2>(ygapdn ,""<FONT color=#0000ff 
  size=2>,Colorgapdown ,4<FONT 
  color=#0000ff size=2>+8<FONT 
  color=#0000ff size=2>);
  Plot<FONT color=#0000ff 
  size=2>(ygapup,""<FONT color=#0000ff 
  size=2>,Colorgapup ,4<FONT 
  color=#0000ff size=2>+8<FONT 
  color=#0000ff size=2>);
  Plot<FONT color=#0000ff 
  size=2>(support,""<FONT color=#0000ff 
  size=2>,Colorsupport ,4<FONT 
  color=#0000ff size=2>);
  Plot<FONT color=#0000ff 
  size=2>(resistance,""<FONT 
  color=#0000ff size=2>,Colorresistance ,<FONT color=#282828 
  size=2>4);
  }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












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.



Attachment:
Non.jpg

Attachment: Description: "Description: JPEG image"