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

Re: [amibroker] Re: Using timeframeset with looping code



PureBytes Links

Trading Reference Links

o, ok. Well I added a more simple example to show that it just works,

rgds, Ed


SetBarsRequired(100000,100000);

TimeFrameSet( inWeekly ); 

xx = C; xx = 0;
xx[ 0 ] = C[ 0 ];
 
for(i = 0; i < BarCount; i++) { 

 xx[ i ] = (H[ i ] + L[ i ]) / 2; 

}

// restore to current timeframe
TimeFrameRestore(); 

// expand weekly data arrays to current time frame
exx = TimeFrameExpand( xx, inWeekly, expandFirst );

Filter=1;
AddColumn(C,"close",1.3);
AddColumn(xx,"xx",1.3);
AddColumn(exx,"exx",1.3);

Plot(C,"",colorWhite,64);

// expanded to daily
Plot(exx,"",colorBlue,1);

// weekly 
Plot(xx,"",colorBrightGreen,1);



  ----- Original Message ----- 
  From: kaveman perth 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, October 10, 2004 1:53 PM
  Subject: Re: [amibroker] Re: Using timeframeset with looping code


  Sorry should have put in the way I found to do it
  I recalled that timeframe functions compress the data into the last
  bars of the chart, so I had to start the loop from the first bar of
  the actual weekly data within the daily chart bars

  numweeks = LastValue( Cum( DayOfWeek()>Ref(DayOfWeek(),1) ) );

  TimeFrameSet(inWeekly);
  //x[BarCount-numweeks-1]=C[BarCount-numweeks-1];
  x[0]=C[0];
  //for(i=1;i<BarCount;i++)

  for(i=BarCount-numweeks;i<BarCount;i++)
  {
  if(C[i]>x[i-1])
  {
  x[i]=C[i];
  }
  else
  {
  x[i]=x[i-1];
  }
  }

  TimeFrameRestore();

  xx = TimeFrameExpand( x, inWeekly );

  Filter=1;
  AddColumn(C,"close",1.3);
  AddColumn(x,"x",1.3);
  AddColumn(xx,"xx",1.3);


  On Sun, 10 Oct 2004 13:43:35 +0200, ed nl <ed2000nl@xxxxxxx> wrote:
  > 
  > Graham,
  > 
  > I was just looking at it and I couldn't figure it out myself .... even though I have written a similar program (see: http://www.amibroker.com/library/detail.php?id=357)
  > 
  > I rewrote your code but for some reason xx and xxx stay the same. What was the cause of the problem? Must be some detail right?
  > 
  > rgds, Ed
  > 
  > SetBarsRequired(100000,100000);
  > 
  > TimeFrameSet( inWeekly );
  > 
  > xx = C; xx = 0;
  > xx[ 0 ] = C[ 0 ];
  > 
  > for(i = 1; i < BarCount; i++) {
  > 
  > if(C[ i ] > xx[ i - 1 ]) {
  > 
  >  xx[ i ] = C[ i ];
  > 
  > } else {
  > 
  >  xx[ i ] = xx[ i - 1 ];
  > 
  > }
  > 
  > }
  > 
  > // restore to current timeframe
  > TimeFrameRestore();
  > 
  > // expand weekly data arrays to current time frame
  > xxx = TimeFrameExpand( xx, inWeekly );
  > 
  > Filter=1;
  > AddColumn(C,"close",1.3);
  > AddColumn(xx,"xx",1.3);
  > AddColumn(xxx,"xx",1.3);
  > 
  > Plot(C,"",colorWhite,64);
  > 
  > // expanded to daily
  > Plot(xxx,"",colorBlue,1);
  > 
  > // weekly
  > Plot(xx,"",colorBrightGreen,1);
  > 
  > 
  >  ----- Original Message -----
  >  From: kavemanperth
  >  To: amibroker@xxxxxxxxxxxxxxx
  >  Sent: Sunday, October 10, 2004 1:40 PM
  >  Subject: [amibroker] Re: Using timeframeset with looping code
  > 
  >  No problems, why is it after scratching my head for weeks on this,
  >  that after giving up and asking for help I work it out.
  > 
  >  graham
  > 
  >  --- In amibroker@xxxxxxxxxxxxxxx, kaveman perth <kavemanperth@xxxx>
  >  wrote:
  >  > I cannot seem to get the timeframeset to work with any code that
  >  contains loops.
  >  > I want to explore on weekly values for setups, then trade on daily
  >  > values breaking the weekly setups. This is especially important as
  >  I
  >  > am trying to backtest for this code. Rather than post a long code
  >  that
  >  > would take time to work through I have put together a simple
  >  formula
  >  > that will return the highest close, just purely as an example. I
  >  can
  >  > get values if I set the AA settings to weekly, but if put to daily
  >  I
  >  > get empty cells in the exploration.
  >  > Can someone help me on how to get this to work
  >  >
  >  > TimeFrameSet(inWeekly);
  >  > x[0]=C[0];
  >  > for(i=1;i<BarCount;i++)
  >  > { if(C[i]>x[i-1])
  >  > { x[i]=C[i];
  >  > }
  >  > else
  >  > { x[i]=x[i-1];
  >  > } }
  >  > TimeFrameRestore();
  >  >
  >  > xx = TimeFrameExpand( x, inWeekly );
  >  >
  >  > Filter=1;
  >  > AddColumn(C,"close",1.3);
  >  > AddColumn(x,"x",1.3);
  >  > AddColumn(xx,"xx",1.3);
  >  >
  >  > --
  >  > Cheers
  >  > Graham
  >  > http://e-wire.net.au/~eb_kavan/
  > 
  >  Check AmiBroker web page at:
  >  http://www.amibroker.com/
  > 
  >  Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  > 
  > 
  >        Yahoo! Groups Sponsor
  >              ADVERTISEMENT
  > 
  > ------------------------------------------------------------------------------
  >  Yahoo! Groups Links
  > 
  >    a.. To visit your group on the web, go to:
  >    http://groups.yahoo.com/group/amibroker/
  >      
  >    b.. To unsubscribe from this group, send an email to:
  >    amibroker-unsubscribe@xxxxxxxxxxxxxxx
  > 
  >    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
  > 
  > 
  > [Non-text portions of this message have been removed]
  > 
  > 
  > 
  > 
  > 
  > Check AmiBroker web page at:
  > http://www.amibroker.com/
  > 
  > Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
  > Yahoo! Groups Links
  > 
  > 
  > 
  > 
  > 


  -- 
  Cheers
  Graham
  http://e-wire.net.au/~eb_kavan/


  Check AmiBroker web page at:
  http://www.amibroker.com/

  Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 


        Yahoo! Groups Sponsor 
              ADVERTISEMENT
             
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/
      
    b.. To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx
      
    c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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