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

[RT] Re: Display of Multiple time frames on same chart



PureBytes Links

Trading Reference Links

Well, at one point I thought I had solved the problem of the boxes 
not always encapsulating the correct grouping of smaller time frame 
bars (see previous post below), but not so far, anyway.  Perhaps 
someone else will have better luck.  Here's my very small 
contribution though to make the boxes different colors depending on 
whether the close of the final bar is greater, less than, or equal to 
the open of the first bar, thereby making the boxes somewhat similar 
in appearance to up and down (and doji) candlesticks:


{Indicator:  NBarBox}
  
{Purpose:    Draw a box covering NBars with the bottom of the
             box corresponding to the Lowest Low in the NBars
             of the group and the top of the box being the
             Highest High in the group.
 
             Vertical lines are drawn at the beginning and end
             of the group of bars and extends from LL to HH.
 
 Use:        Display higher time frame on chart.
 
 Problems:   ONLY FOR TS2000 unless you add something to insure
             only the most recent 600 or so trendlines are 
             drawn -- that would cover 150 groups.
 
             DO NOT APPLY TO A VERY LONG DATA SERIES AS IT WILL
             TAKE A VERY LONG TIME TO UPDATE ! ! !
 
 Author:     Clyde Lee, Copyright 2001
 
 Permission: This application for Omega Tradestation can be 
             freely distributed with proper credit.
}
 
Input:  NBars(4),      {Number of bars to be included in box }
        Shift(0),      {Move starting bar by amount entered  }
        UpColor(white),{Line color for box		     }
	DownColor(red),
	DojiColor(yellow),
        LSize(0);      {Line size for box                    }
 
Vars:   MBars(NBars-1),HH(0),LL(0),LColor(0);

If Close > Open[MBars] Then LColor = UpColor;
If Close < Open[MBars] Then LColor = DownColor;
If Close = Open[MBars] Then LColor = DojiColor;

If Mod(CurrentBar,NBars)=Shift then begin
  HH=Highest(H,NBars);
  LL=Lowest(L,Nbars);
  Value1=TL_New(Date[Mbars], Time[MBars], HH, Date, Time, HH);  
  Value2=TL_New(Date[Mbars], Time[MBars], LL, Date, Time, LL);
  Value3=TL_New(Date[Mbars], Time[MBars], HH, Date[MBars], Time
    [MBars], LL);  
  Value4=TL_New(Date, Time, HH, Date, Time, LL);
  TL_SetColor(Value1, LColor);
  TL_SetColor(Value2, LColor);
  TL_SetColor(Value3, LColor);
  TL_SetColor(Value4, LColor);
  TL_SetSize(Value1, LSize);
  TL_SetSize(Value2, LSize);
  TL_SetSize(Value3, LSize);
  TL_SetSize(Value4, LSize);
End;
{End of Code}

--- In realtraders@xxxx, mark_baze@xxxx wrote:
Thanks much Clyde, I've been wanting something like this for a 
while.  Is there a modification that can be made to force the boxes 
to consistently start at the beginning of each new date on an 
intraday chart?  For example, on a 5 min time frame, with NBars set 
to 3 (i.e., attempting to encapsulate three 5 min bars in order to 
represent a 15 min bar), occasionally the last one or two 5 min bars 
from the prior date will be used as the first, or first and second, 
of the three bars used to generate the first box for a given date and 
this will result in all the subsequent boxes being incorrectly 
shifted so that it can be seen that the boxes don't match up with 
actual 15 min bars plotted as data2.  The boxes periodically regain 
and then lose their proper shifting over the course of time (days).  
The problem is due to the data on multiple days not being perfectly 
consistent (and so the "Shift" input doesn't help in this regard) , 
and not with your indicator per se.  I've tried a number of different 
things without success.  It seems as if one possibility could be to 
use a second MOD function with CURRENTTIME to force the boxes to 
begin at precise time intervals, but I haven't been able to make it 
work (e.g., Mod(CurrentTime,0015) = 0 in the case of 15 min bars).  I 
couldn't get anything using Date > Date[1] to work either.
Thanks,
Mark



To unsubscribe from this group, send an email to:
realtraders-unsubscribe@xxxxxxxxxxxxxxx

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/