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

Re: [amibroker] LineArray for RealTime



PureBytes Links

Trading Reference Links

Hello,

This post send by LaL could help you... :-)

Best regards

------------------------------------------------------------------------------
//Prior Day Open-High-Low-Close

SetChartOptions( 1, chartShowDates );

PlotOHLC( Open, High, Low, Close, "", colorBlack, styleCandle );
Show_Prev = ParamToggle("Display Prev HLC", "No|Yes", 1);

// Get Previous Day's close, Low and High
Prev_Open = TimeFrameGetPrice( "O", inDaily, -1, expandFirst) ;
Prev_High = TimeFrameGetPrice( "H", inDaily, -1, expandFirst) ;
Prev_Low = TimeFrameGetPrice( "L", inDaily, -1, expandFirst) ;
Prev_Close = TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;
Today = LastValue(Day() );//Today = Day();
if(Show_Prev)
{
Plot(IIf(Today == Day(), Prev_Open, Null), "Prev Open", ParamColor("Prev Open", colorYellow), styleLine|styleThick|styleNoRescale);
Plot(IIf(Today == Day(), Prev_High, Null), "Prev High", ParamColor("Prev High", colorAqua), styleLine|styleThick|styleNoRescale);
Plot(IIf(Today == Day(), Prev_Low, Null), "Prev Low", ParamColor("Prev Low", colorOrange), styleLine|styleThick|styleNoRescale);
Plot(IIf(Today == Day(), Prev_Close, Null), "Prev Close", ParamColor("Prev Close", colorWhite), styleLine|styleThick|styleNoRescale);
}
------------------------------------------------------------------------------
NB: The bit that goes "Today == Day()" has a double "equal to" sign

if you want to show the Previous Day High, Low and Close for ALL days, use this line:
Today = Day();
instead of  "Today = Lastvalue(Day());"

Lal


jim_wiehe a écrit :

Someone has posted an Afl in the Amibroker library that uses the
linearry function for real time charting. It will do exactly what I
want but it doesn't draw the lines. Pasted below is the code, does
anyone have a suggestion?

////////////////////////////////////////////////////////////////////

//File: Bruce Chart
//August 5, 2005
//
//Program computes and displays various price values in real time
//
// Today's Open
// Prior Day High
// Prior Day Low
// Prior Day Open
// Prior Day Close
// Prior Day Middle
// First Hour High
// First Hour Low

PlotOHLC(Open,High,Low,Close,"",colorBlack,styleCandle);
Bars = 0;
xpdh = 90;

//Levels = 1 activates program
Levels = Param("Levels",1,0,1,1);
ExpFirst = Param("ExpFirst",1,0,1,1);

if (Levels ==1)
{
//Convert data to daily
Plot_Range = (TimeNum() >= 93000 AND TimeNum()<= 160000) AND
(DateNum()==LastValue(DateNum()));
FH_Range = (TimeNum() >= 93000 AND TimeNum()<= 100000);// AND
(DateNum()==LastValue(DateNum()));

FH_Prices = High * FH_Range;
FH_Marker = BarsSince(FH_Range>0);

//Find number of bars in 60 minutes
Num_Bars = 3600 / Interval(1);

TimeFrameSet(inDaily);
TOP_ = Open;
PDH_ = Ref(High,-1);
PDL_ = Ref(Low,-1);
PDO_ = Ref(Open,-1);
PDC_ = Ref(Close,-1);
PDM_ = (PDH_+PDL_)/2;
TimeFrameRestore();

// provides the coordinates for the linearry function
TOP = TimeFrameExpand(TOP_,inDaily,expandFirst);
PDH = TimeFrameExpand(PDH_,inDaily,expandFirst);
PDL = TimeFrameExpand(PDL_,inDaily,expandFirst);
PDO = TimeFrameExpand(PDO_,inDaily,expandFirst);
PDC = TimeFrameExpand(PDC_,inDaily,expandFirst);
PDM = TimeFrameExpand(PDM_,inDaily,expandFirst);

FHH = Ref(HHV(High*FH_Range,Num_Bars),-FH_Marker);
FHL = Ref(LLV(Low,Num_Bars),-FH_Marker);

Bars = BarsSince(TimeNum() >= 62900 AND TimeNum() <
64400);//,BarIndex(),1); // AND DateNum()==LastValue(DateNum());

x1 = BarCount - LastValue(Bars);

x0 = BarCount-1;
TOP_Line = LineArray(x0,LastValue(TOP),x1,LastValue(TOP),0);
PDH_Line = LineArray(x0,LastValue(PDH),x1,LastValue(PDH),0);
PDL_Line = LineArray(x0,LastValue(PDL),x1,LastValue(PDL),0);
PDC_Line = LineArray(x0,LastValue(PDC),x1,LastValue(PDC),0);
PDM_Line = LineArray(x0,LastValue(PDM),x1,LastValue(PDM),0);
FHH_Line = LineArray(x0,LastValue(FHH),x1,LastValue(FHH),0);
FHL_Line = LineArray(x0,LastValue(FHL),x1,LastValue(FHL),0);

Plot(TOP_Line,"",colorGreen,styleDashed|styleNoRescale);
Plot(PDH_Line,"",colorPlum,styleLine|styleNoRescale);
Plot(PDL_Line,"",colorRed,styleLine|styleNoRescale);
Plot(PDC_Line,"",colorAqua,styleLine|styleNoRescale);
Plot(PDM_Line,"",colorYellow,styleLine|styleNoRescale);
Plot(FHH_Line,"",IIf(FH_Range==1,Null,colorBlue),styleLine|styleNoRescale);
Plot(FHL_Line,"",IIf(FH_Range==1,Null,colorBlue),styleLine|styleNoRescale);

}

Title = Name() + " Daily Levels Bruce 1 " + Interval(2) + " " +
WriteVal(TimeNum(),1.0)
+ " Open: " + WriteVal(Open,1.2) + " High: "
+ WriteVal(High,1.2)
+ " Low: " + WriteVal(Low,1.2) + " Close: " + WriteVal(Close,1.2);


__._,_.___

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL 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

*********************************




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___