I found an exception in intraday stock databases where some symbols don't have out of session trading i.e. the first OR last bar of the day is the start/end of the day as well as the session.
I think the fix is as per the code added to the StartOfSession bar marker.... EOS code will probably need a similar approach. It hasn't been thoroughly tested but I gotta go. //P_IntradaySession /*Plots a histogram at the closing, or opening, bar of a session (as defined by the times entered) For symbols were there is no out of session trading DateNum comparison may be required as per SOSTimeBar code */ TimeBar = TimeNum() >= 160000; TimeBar2 = TimeNum() < 160000; EOSTimeBar = TimeBar == 1 AND Ref(Timebar2,-1) == 1; Plot (EOSTimeBar,"EndOfSession",colorRed,styleHistogram|styleOwnScale|style Dashed|styleThick); TimeBar3 = TimeNum() >= 093000; //Plot(TimeBar3,"TimeBar3",colorGreen,1); TimeBar4 = TimeNum() < 093000; //Plot(TimeBar4,"TimeBar4",colorRed,1); SOSTimeBar = TimeBar3 == 1 AND (Ref(Timebar4,-1) == 1 OR DateNum() != Ref(DateNum(),-1)); Plot (SOSTimeBar,"StartOfSession",colorGreen,styleHistogram|styleOwnScale|s tyleDashed|styleThick); --- In [email protected], "brian_z111" <[EMAIL PROTECTED]> wrote: > > I think this will do it. > > I was using something similar to yours and putting up with the odd > missing marker so I decided to upgrade since you are 'in the market' > for the code. > > Let me know if you have any problems cos I am using it myself and I > haven't done any extensive testing (sometimes odd exceptions show up > with longer term use). > > I didn't put much thought into it - possibly there are better ways to > do it. > > > //P_IntradaySession > > /*Plots a histogram at the closing > bar of a session (as defined by the times entered) > The plots commented out were used in an indicator pane for > code testing. > Final version is for use as an overlay plot. > > The bar that starts the day session, or any period of interest, > can be highlighted the same way via addition of similar code. > > Tested once on an intraday database with basetime == 1 minute, > selected timeframe == 5 min and intraday preferences set to > "time stamp of compressed intraday bar shows: time of first tick > inside bar" > > It should work on any elected timeframe. > > Dashed style is more effective for overlaying bar charts as it > doesn't 'hide' the > bars to the same extent. > > */ > > > TimeBar = TimeNum() >= 160000; > > //Plot(TimeBar,"TimeBars",1,1); > > TimeBar2 = TimeNum() < 160000; > > //Plot(TimeBar2,"TimeBars",colorRed,1); > > EODTimeBar = TimeBar == 1 AND Ref(Timebar2,-1) == 1; > > //Plot(EODTimeBar,"TimeBars",colorGreen,styleHistogram); > > Plot(EODTimeBar,"TimeBars",colorGreen,styleHistogram|styleOwnScale); > > > > --- In [email protected], "Tim" <raven4ns@> wrote: > > > > Hello, > > I use this code to mark the end of trading on my volume charts for > > each day. However, on some charts there are still some candles > beyond > > the line it draws on my chart pertaining to that day, in otherwords > it > > isn't plotting the vertical lines correctly timewise. Would someone > > please look at the code and tell me how to correct this? I tried > > adjusting the end time to 165959 but then it wouldn't generate any > > lines at all. Any help will be most appreciated. Thank you very > much. > > > > EndTime = 165900; > > > > StartTime = 092900; > > > > Plot( Cross( TimeNum(), EndTime ), "", colorBlue, styleHistogram > > > > | styleOwnScale | styleDashed, 0, 1 ); > > > > Plot( Cross( TimeNum(), StartTime ), "", colorBlue, styleHistogram | > > > > styleOwnScale | styleDashed, 0, 1 ); > > > > > > > > Best regards, > > > > Tim > > >
