Thanks Ian. It works a treat. All the best Ken --- On Fri, 26/9/08, ian_rosbif <[EMAIL PROTECTED]> wrote:
From: ian_rosbif <[EMAIL PROTECTED]> Subject: [amibroker] Re: Visibility of MA To: [email protected] Received: Friday, 26 September, 2008, 8:08 AM Hi Ken, Sorry - I didn't explain it very well. Here's a re-jigged copy of the code that seems to work. I've taken out the _SECTION breaks, as I think they may be muddying the waters. It also seems that GraphZOrder is FALSE by default, so you could argue it's not needed as long as the STYLEAREA plot is done last. I've left GraphZOrder in as a commented line, so you can play with TRUE/FALSE values to see what it does. Cheers, Ian // Variable Timeframe TimeFrameSet( in5Minute ); // switch to 5 minute frame TimeFrame= Param("Chart Timeframe (min)",5,5,60, 5)*60; TimeFrameSet( TimeFrame) ; TN = TimeNum(); ParamStartTime = ParamTime("Session Start","09:50: 00"); ParamEndTime = ParamTime("Session End","16:30: 00"); InSessionTime = TN >= ParamStartTime AND TN <= ParamEndTime; StartOfSession = InSessionTime > Ref(InSessionTime, -1); EndOfSession = InSessionTime < Ref(InSessionTime, -1); InsessionTime = InSessionTime OR EndOfSession; Plot( C, "Close", ParamColor(" Color", colorYellow ), styleNoTitle | ParamStyle(" Style") | GetPriceStyle( ) ); if( ParamToggle( "Tooltip shows", "All Values|Only Prices" ) ) { { ToolTip=StrFormat( "Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f% %)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1 ))); } Plot( InSessionTime, "",1,styleArea| styleOwnScale| styleNoLabel, 0,550); Plot( StartOfSession, "",1,styleArea| styleOwnScale| styleNoLabel, 0,30); Plot( EndOfSession, "",4,styleArea| styleOwnScale| styleNoLabel, 0,30); } OutOfSessionColor = ParamColor(" Out of Session",colorDarkR ed); //REMOVED... .Plot(NOT InSessionTime, "",OutOfSessionC olor,styleArea| styleOwnScale| styleNoLabe l,0,1); if(ParamToggle( "Equity curve","HIDE| SHOW",0) ) { Plot(TradeEquity, "",2,styleStairc ase|styleOwnScal e); } P = ParamField(" Price field",-1); Periods = Param("Periods" , 8, 2, 200, 1, 10 ); Plot( MA( P, Periods ), _DEFAULT_NAME( ), ParamColor( "Color", colorCycle ), ParamStyle(" Style") ); //INSERTED.. .. //GraphZOrder = False; Plot(NOT InSessionTime, "",OutOfSessionC olor,styleArea| styleOwnScale| styleNoLabe l,0,1); --- In [EMAIL PROTECTED] ps.com, Ken H <[EMAIL PROTECTED] .> wrote: > > Hi Ian > Â > I am not having much success as I am obviosly missing something? > Â > Is this what you meant? > Â > Â > Â _SECTION_BEGIN( "MA"); > > P = ParamField(" Price field",-1); > > Periods = Param("Periods" , 8, 2, 200, 1, 10 ); > > Plot( MA( P, Periods ), _DEFAULT_NAME( ), ParamColor( "Color", > > colorCycle ), "GraphZOrder= False", ParamStyle(" Style") ); > > _SECTION_END( ); > > Many thanks > Â > Ken > > --- On Wed, 24/9/08, ian_rosbif <ian_rosbif@ ...> wrote: > > From: ian_rosbif <ian_rosbif@ ...> > Subject: [amibroker] Re: Visibility of MA > To: [EMAIL PROTECTED] ps.com > Received: Wednesday, 24 September, 2008, 4:18 AM > > > > > > > Hi Ken, > If "night session" means the area plotted in red (it shows as an area > from 08:00 to 09:45 on my chart - my database session settings could > be different to yours): > You need to plot the stylearea after everything else & put > a "GraphZOrder = False" immediately before it. That way the price & > MA are overlayed on the stylearea plot. > Cheers, > Ian > > --- In [EMAIL PROTECTED] ps.com, "Ken Hendo" <sfehendo@ .> wrote: > > > > Hi > > > > On the code below, can anyone advise how to make the moving average > > appear on the chart during the night session? > > > > Many thanks > > > > Ken > > > > > > // Variable Timeframe > > TimeFrameSet( in5Minute ); // switch to 5 minute frame > > > > TimeFrame= Param("Chart Timeframe (min)",5,5,60, 5)*60; > > > > TimeFrameSet( TimeFrame) ; > > > > TN = TimeNum(); > > > > ParamStartTime = ParamTime("Session Start","09:50: 00"); > > > > ParamEndTime = ParamTime("Session End","16:30: 00"); > > > > InSessionTime = TN >= ParamStartTime AND TN <= ParamEndTime; > > > > StartOfSession = InSessionTime > Ref(InSessionTime, -1); > > > > EndOfSession = InSessionTime < Ref(InSessionTime, -1); > > > > InsessionTime = InSessionTime OR EndOfSession; > > > > _SECTION_END( ); > > > > _SECTION_BEGIN( "PLOTTING" ); > > > > Plot( C, "Close", ParamColor(" Color", colorYellow ), styleNoTitle | > > ParamStyle(" Style") | GetPriceStyle( ) ); > > if( ParamToggle( "Tooltip shows", "All Values|Only Prices" ) ) > > { > > { > > ToolTip=StrFormat( "Open: %g\nHigh: %g\nLow: %g\nClose: %g > (%.1f% > > %)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, > > 1 ))); > > } > > Plot( > InSessionTime, "",1,styleArea| styleOwnScale| styleNoLabel, 0,550); > > > > Plot( > StartOfSession, "",1,styleArea| styleOwnScale| styleNoLabel, 0,30); > > > > Plot( EndOfSession, "",4,styleArea| styleOwnScale| styleNoLabel, 0,30); > > } > > OutOfSessionColor = ParamColor(" Out of Session",colorDarkR ed); > > > > Plot(NOT > > > InSessionTime, "",OutOfSessionC olor,styleArea| styleOwnScale| styleNoLabe > > l,0,1); > > > > if(ParamToggle( "Equity curve","HIDE| SHOW",0) ) > > { > > Plot(TradeEquity, "",2,styleStairc ase|styleOwnScal e); > > } > > _SECTION_END( ); > > > > > > > > _SECTION_BEGIN( "MA"); > > P = ParamField(" Price field",-1); > > Periods = Param("Periods" , 8, 2, 200, 1, 10 ); > > Plot( MA( P, Periods ), _DEFAULT_NAME( ), ParamColor( "Color", > > colorCycle ), ParamStyle(" Style") ); > > _SECTION_END( ); > > > > > > > > > > > > > > > > > > > Make the switch to the world's best email. Get Yahoo!7 Mail! http://au.yahoo. com/y7mail > Make the switch to the world's best email. Get Yahoo!7 Mail! http://au.yahoo.com/y7mail
