Question: A customer asked, “How do I make OHLC bars with my indicator?”

Answer: This can be accomplished with real time data. Your indicator needs to track Open, High and Low values with intrabarpersist variables. It also needs to track when the bars of source data streams close. That way your indicator can determine when the opening tick occurs, and when to reset the high and low variables.

Here is an example EasyLanguage indicator, creating bars for (Up Volume – Down Volume) values:

{
DEMO
By: David O’Dell
[email protected]
!QCL Solutions
P.O. Box 2304
Palm City, FL 34990
347-746-1725

For intraday and tick bars only.

.iat MyRTHighLow
}
Input:
 DataNum(1),
 AvgLength(50),
 NumDevs(1),
 ShowBaseline_ok1(1),
 Baseline(0);

Const: int BogusValue(9999999);

Variables:
 MyValue(0), MyAvgValue(0), MyStDevValue(0),
 vShowBaseline(ShowBaseline_ok1=1),
 intrabarpersist Op(BogusValue),
 intrabarpersist HH(0),
 intrabarpersist LL(BogusValue),
 intrabarpersist OnPriorBarClosed(True);

MyValue = UpTicks – DownTicks {example calculation};
MyAvgValue = Average(MyValue, AvgLength);
MyStDevValue = StandardDev(MyValue, AvgLength, 2);

if (GetAppInfo(aiRealTimeCalc) = 1) then
begin
 if OnPriorBarClosed then
 begin
  Op = MyValue;
  HH = MyValue;
  LL = MyValue;
 end
 else
 begin
  HH = MaxList(MyValue, HH);
  LL = MinList(MyValue, LL);
 end;
 if Op <> BogusValue then
  Plot1(Op, “RTOpen”);
 Plot2(HH, “RTHigh”);
 Plot3(LL, “RTLow”);
end;
Plot4(MyValue, “RTClose”);
Plot5(MyAvgValue, “AvgClose”);
Plot6(MyAvgValue + NumDevs * MyStDevValue, “UpperBand”);
Plot7(MyAvgValue – NumDevs * MyStDevValue, “LowerBand”);

if ((GetAppInfo(aiApplicationType)=cChart) and vShowBaseline) then
 Plot11(Baseline, “Baseline”);
OnPriorBarClosed = (BarStatus(DataNum) = 2);

 Note that property settings for this indicator are important.

I’ll email the zipped folder to you. Send the request below.
Or email request directly to [email protected].

Request:

 

Regards,

David O’Dell