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

Re: [amibroker] Multiple Timeframes in the same sheet



PureBytes Links

Trading Reference Links




Hello,
 
Did you read entire "READ ME" file?  

 
It gives you ready-to-use code.
 
EXAMPLE 2: weekly candlestick chart overlaid on 
line daily price chart
wo = TimeFrameGetPrice( "O", inWeekly, 0, expandPoint );wh = 
TimeFrameGetPrice( "H", inWeekly, 0, expandPoint );wl = TimeFrameGetPrice( 
"L", inWeekly, 0, expandPoint );wc = TimeFrameGetPrice( "C", inWeekly, 0, 
expandPoint );
PlotOHLC( wo, wh, wl, wc, "Weekly Close", colorWhite, styleCandle 
);Plot( Close, "Daily Close", colorBlue ); 
As to your attempts: TimeFrameExpand is a <FONT color=#ff0000 
size=6>FUNCTION
the result is RETURNED by the function and arguments passed are NOT 
affected.
In AFL all functions work like that. 
 
In your code you are DISCARDING return value .
 
So your first code should look like this:
 

TimeFrameSet( 
inWeekly );<FONT 
size=2>
cw = TimeFrameExpand<FONT 
color=#0000ff>(Close, 
inWeekly,<FONT 
size=2>expandLast );  // 
RETURN VALUE must be assigned 
ow = TimeFrameExpand<FONT 
color=#0000ff>(Open, 
inWeekly,<FONT 
size=2>expandLast );  // 
RETURN VALUE must be assigned 
hw =TimeFrameExpand<FONT 
color=#0000ff>(High, 
inWeekly,<FONT 
size=2>expandLast );  // 
RETURN VALUE must be assigned 
lw = TimeFrameExpand<FONT 
color=#0000ff>(Low, 
inWeekly,<FONT 
size=2>expandLast );  // 
RETURN VALUE must be assigned 
CL=<FONT 
size=2>IIf(Cw<FONT 
size=2>>O,<FONT 
size=2>1,0); //color 
of bar
PlotOHLC<FONT 
size=2>( ow, hw, lw, cw, "Weekly 
Prices", CL ,styleBar<FONT 
size=2> );
 
As to you wanting NOT to have weekly/monthly bars spread to match the 
daily bars:
 
Sorry but it is not intended use. The intended use 
of TimeFrame functionsis to MIX different 
timeframes in single indicator and come back to 
originalinterval.  Implementing your suggestion would generate mess if 
the formula hasseveral time frames inside.You should always 
"EXPAND" using TimeFrameExpand data to be plotted/displayedto make them 
match with the dates in the date 
axis:TimeFrameSet(inWeekly);Plot(TimeFrameExpand( MA(C,14), inWeekly 
), "Weekly", colorRed);
You want a different X axis but 
the problem is that this is not only the question of date axis.I would 
need to rewrite also all code handling drawings becauseit is based on dates 
in currently selected interval alsoscrolling routines, etc. etc. What's more 
one would get complete mess
if your formula used multiple TimeFrameSet commands
because no one would ever know which frame you want to display
and how to align bars.
 
What you want to achieve will be addressed by completely 
independent
developments on the way:
1. linked windows (in fact what Window->Clone 
does but allowingdifferent intervals to be selected )2. ability to 
'override' individual pane time interval. 
 
This will be different than TimeFrame functions in that that you 
won'tneed to change the formula at all. Just one setting'lock interval 
to: ': weekly and given pane will be weekly 
always.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  CS 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Tuesday, September 09, 2003 11:54 
  AM
  Subject: Re: [amibroker] Multiple 
  Timeframes in the same sheet
  <FONT 
  color=#000000>
  Tomasz,
   
  I DON'T want the weekly or monthly bars spread apart 
  to match the daily bars. I am trying to create the plots as 
  they appeared in the previous post.
   
  To try your suggestion anyway, I used the following formulas on the 
  weekly plot. Picture below.
  TimeFrameSet( 
  inWeekly );<FONT 
  size=2>
  TimeFrameExpand<FONT 
  color=#0000ff>(Close, 
  inWeekly,<FONT 
  size=2>expandLast );
  TimeFrameExpand<FONT 
  color=#0000ff>(Open, 
  inWeekly,<FONT 
  size=2>expandLast );
  TimeFrameExpand<FONT 
  color=#0000ff>(High, 
  inWeekly,<FONT 
  size=2>expandLast );
  TimeFrameExpand<FONT 
  color=#0000ff>(Low, 
  inWeekly,<FONT 
  size=2>expandLast );
  CL=<FONT 
  size=2>IIf(C<FONT 
  size=2>>O,<FONT 
  size=2>1,0); 
  //color of bar
  Plot( 
  Close, "Weekly 
  Prices", CL ,styleBar<FONT 
  size=2> );
   
  --and--
   
  TimeFrameSet<FONT 
  size=2>( inWeekly<FONT 
  color=#0000ff> );
  EC=<FONT 
  size=2>TimeFrameExpand(<FONT 
  size=2>Close,inWeekly<FONT 
  size=2>,expandLast<FONT 
  color=#0000ff>);
  CL=<FONT 
  size=2>IIf(C<FONT 
  size=2>>O,<FONT 
  size=2>1,0); 
  //color of bar
  Plot( 
  EC,"Weekly Prices",<FONT 
  face=Verdana size=2>CL, <FONT 
  size=2>styleBar);
   
  Neither formulas resulted in the weekly bars 
  being expanded to line up with the daily bars. Yes, I understand 
  that IF the weekly bars were expanded like they should have been, THEN 
  the dates for the weekly bars would be correct.
   
  Back to my original problem:
  I have preferences set to display 255 bars. 
  Periodicity in the toolbar is set to DAILY.
   
  A. In the top frame, I need 255 bars to be displayed 
  for daily. This works.
  B. I need the dates in the daily X-axis to correspond 
  to these daily bars. This works.
   
  C. In the middle frame, I need 255 bars to be 
  displayed for weekly. This works.
  
  D. I need the dates in the X-axis of the weekly bars 
  to correspond to these weekly bars. This does not 
  work, with or without <FONT 
  color=#0000ff>TimeFrameExpand.
   
  E. In the bottom frame, I need 255 bars displayed for 
  monthly. This works.
  
  F. I need the dates in the X-axis of the monthly bars 
  to correspond to these monthly bars. This does <FONT 
  color=#ff0000>not work, with or without <FONT 
  color=#0000ff>TimeFrameExpand.
   
  G. Display all three frames in the same sheet at 
  the same time. Just like the pictures in the previous post. (I suspect 
  this is the cause of the problem.)  
  
   
  Thanks,
  -CS
   
  <IMG alt="" hspace=0 src="png00187.png" 
  align=baseline border=0>
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Tomasz Janeczko 
    
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Tuesday, September 09, 2003 1:19 
    AM
    Subject: Re: [amibroker] Multiple 
    Timeframes in the same sheet
    
    Hello,
     
    Currently as per Read Me description you have to use 
    TimeFrameExpand ...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.


Attachment: Description: ""