There are a number of codes in the Library that address this type of plot.

Bill
  ----- Original Message ----- 
  From: ozzyapeman 
  To: [email protected] 
  Sent: Thursday, October 16, 2008 1:00 AM
  Subject: [amibroker] Basic line plot referencing earlier Bar - not working


  Hi, hoping someone can chime in on this basic line plot question. I seem to 
be having a lot of basic plotting problems lately, on stuff that I am sure 
should work.

  In this case, all I want to do is draw a line between the current Close and 
the Low of 5 bars ago, if the current Close is lower than that Low.

  This is what I have, but the lines do not plot. I'm also wondering if I even 
need to use looping for this or if I can do it without loops. Any input 
appreciated:


  SetChartOptions(0, chartShowArrows|chartShowDates); 
    _N(Title = StrFormat("{{INTERVAL}} {{DATE}} \n{{VALUES}}", 
                         O, H, L, C, V, SelectedValue(ROC(C, 1)) )); 
     
  Plot(C, "Close", colorBlack, styleThick|styleDots); 
  Plot(H, "High",  colorBlue,  styleLine); 
  Plot(L, "Low",   colorRed,   styleLine); 


  // Any time that the current Close is lower than the *Low* of 5 bars ago, 
then plot a   
  // red dashed line between those two prices. 

  fb       = Max(Status("firstVisibleBar"), 5); 
  lb       = Status("lastVisibleBar"); 

  Low5    = Ref(L, -5); 
  LineLow  = Null; 
     
  for ( i = fb; i < lb; i++ ) 
  { 
    if( C[i] < Low5[i] ) 
    { 
     LLow    = LineArray(i, C[i], i-5, Low5[i] );   
     LineLow = IIf(!IsNull(LLow), LLow, LineLow); 
    }   
  }   

  Plot(LineLow, "LineLow", colorRed, styleDashed); 

   


------------------------------------------------------------------------------



  No virus found in this incoming message.
  Checked by AVG - http://www.avg.com 
  Version: 8.0.173 / Virus Database: 270.8.1/1727 - Release Date: 10/15/2008 
8:02 PM

Reply via email to