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

Re: [amibroker] stramge challenge with timeframes.



PureBytes Links

Trading Reference Links

Wrong.
You are using DEFAULT title. To do what you want you need to
use CUSTOM title.

Also you need to *EXPAND* to base interval.

See the examples:
http://www.amibroker.com/guide/h_timeframe.html

_SECTION_BEGIN("Weekly MACD"); 
TimeFrameSet( inWeekly ); 
intname = Interval( 2 ); 
weekmacd = MACD( sh = Param("Short", 12, 1 ), lg = Param( "Long", 26, 1 ) ); 
weeksig = Signal( sh, Lg, Param("Signal", 9, 1 ) ); 
weekhist = weekmacd - weeksig; 
TimeFrameRestore(); 

Plot( TimeFrameExpand( weekmacd, inWeekly ), "MACD", colorRed ); 
Plot( TimeFrameExpand( weeksig, inWeekly ), "Signal", colorBlue ); 
Plot( TimeFrameExpand( weekhist, inWeekly, expandPoint ), "Hist", colorBlack, styleHistogram ); 

if( ParamToggle("Custom Title", "No|Yes", 0 ) ) // custom title 
{ 
  Title = Name() + " " +  intname + " " + Date() + " MACD" +  _PARAM_VALUES(); 
} 
   
_SECTION_END(); 
  


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "murthysuresh" <money@xxxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, September 08, 2008 2:10 AM
Subject: [amibroker] stramge challenge with timeframes.


>i have a Daily chart open with prices. i have programatically plotted 
> the weekly macd histo using the following formula. basically  using 
> timeframeset and timeframerestore. pl note i have set the title 
> within the timeframe set block.
> 
> however the title shows the daily data. the macd chart itself is 
> displaying weekly histo. i verified it. how do i trick the system to 
> show the correct bartime based on the actual plot data and in this 
> case weekly to be displayed.
> 
> the screenshot shows the issue
> http://www.screencast.com/users/junkone/folders/Jing/media/e8d2c670-
> aac5-4e36-bfe2-98b2f5866aa5
> 
> 
> if(getIntervalparam != "default"){
> 
> TimeFrameSet( IntervaltoUse);
> 
> }
> _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %
> g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", 
> O, H, L, C) ) ;
> 
> //MACD - Moving Average Convergence Divergence v1
> //adapted from code by Tomasz Janeczko
> //ideas by Graham Kavanagh and Terry Magic 
> r1 = Param( "Fast avg", 12, 2, 200, 1 ); 
> r2 = Param( "Slow avg", 26, 2, 200, 1 ); 
> r3 = Param( "Signal avg", 9, 2, 200, 1 ); 
> m1 = MACD(r1, r2); 
> s1 = Signal(r1,r2,r3); 
> difference = m1-s1; 
> Plot( m1, StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor
> ("MACD color", colorRed ), ParamStyle("MACD style") ); 
> Plot( s1, "Signal" + _PARAM_VALUES(), ParamColor("Signal color", 
> colorBlue ), ParamStyle("Signal style") ); 
> Plot( difference,"MACD", colorBlack, styleLine | styleThick); 
> 
> Color=IIf(difference > 0,colorGreen,colorRed); 
> Plot(difference, "MACD Histogram", Color, styleNoTitle | ParamStyle
> ("Histogram style", styleHistogram | styleThick | styleNoLabel, 
> maskHistogram ) ); 
> Plot(difference, "", colorBlack,  styleNoTitle|styleLine | styleThick 
> | styleNoLabel ); 
> PlotGrid(0, colorBlack);//,  styleNoTitle|styleLine | styleThick | 
> styleNoLabel ); 
> width=Status("pxchartwidth"  ) ;
> Height=Status("pxchartheight"  ) ;
> 
> GfxSelectPen( colorRed, 1 ); 
> GfxSelectSolidBrush( colorCustom1 ); 
> 
> GfxSelectFont("Tahoma",15, 700 ); 
> GfxSetBkMode(1); 
> GfxSetTextColor(colorGreen); 
> //GfxTextOut(Name() + " Close " + NumToStr(LastValue(C))     , x, y) ;
> GfxTextOut( "Current MACD INTERVAL SHOWN" + getIntervalparam  , 
> width/2, Height/2);
> 
> 
> if(getIntervalparam != "default"){
> 
> TimeFrameRestore() ;
> 
> 
> 
> 
> ------------------------------------
> 
> Please note that this group is for discussion between users only.
> 
> To get support from AmiBroker please send an e-mail directly to 
> SUPPORT {at} amibroker.com
> 
> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
> 
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
> 
> 
> 

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

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/