Bruce,
This is a tradestation easy language code, can you translate to RealCode? Or is there a thread that might be helpful.
thanks...
Better Volume Indicator
Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True), ClimaxChurn(False), LowVolColor(Yellow), ClimaxUpColor(Red), ClimaxDownColor(White), ChurnColor(Green), ClimaxChurnColor(Magenta), Color(Cyan), UseUpTicks(True), Use2Bars(True), ShowAvg(False), AvgColor(Red);
Variables: BarColor(Cyan), Lookback(20);
BarColor = Color;
If BarType > 1 then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+OC))*V;
If C < O and Range <> 0 then Value1 = ((Range+CO)/(2*Range+CO))*V;
If C = O then Value1 = 0.5*V;
Value2 = VValue1;
End;
If BarType <= 1 and UseUpTicks = False then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+OC))*Ticks;
If C < O and Range <> 0 then Value1 = ((Range+CO)/(2*Range+CO))*Ticks;
If C = O then Value1 = 0.5*Ticks;
Value2 = TicksValue1;
End;
If BarType <= 1 and UseUpTicks then begin
Value1 = UpTicks;
Value2 = DownTicks;
End;
Value3 = AbsValue(Value1+Value2);
Value4 = Value1*Range;
Value5 = (Value1Value2)*Range;
Value6 = Value2*Range;
Value7 = (Value2Value1)*Range;
If Range <> 0 then begin
Value8 = Value1/Range;
Value9 = (Value1Value2)/Range;
Value10 = Value2/Range;
Value11 = (Value2Value1)/Range;
Value12 = Value3/Range;
End;
If Use2Bars then begin
Value13 = Value3+Value3[1];
Value14 = (Value1+Value1[1])*(Highest(H,2)Lowest(L,2));
Value15 = (Value1+Value1[1]Value2Value2[1])*(Highest(H,2)Lowest(L,2));
Value16 = (Value2+Value2[1])*(Highest(H,2)Lowest(L,2));
Value17 = (Value2+Value2[1]Value1Value1[1])*(Highest(H,2)Lowest(L,2));
If Highest(H,2) <> Lowest(L,2) then begin
Value18 = (Value1+Value1[1])/(Highest(H,2)Lowest(L,2));
Value19 = (Value1+Value1[1]Value2Value2[1])/(Highest(H,2)Lowest(L,2));
Value20 = (Value2+Value2[1])/(Highest(H,2)Lowest(L,2));
Value21 = (Value2+Value2[1]Value1Value1[1])/(Highest(H,2)Lowest(L,2));
Value22 = Value13/(Highest(H,2)Lowest(L,2));
End;
End;
Condition1 = Value3 = Lowest(Value3,Lookback);
Condition2 = Value4 = Highest(Value4,Lookback) and C > O;
Condition3 = Value5 = Highest(Value5,Lookback) and C > O;
Condition4 = Value6 = Highest(Value6,Lookback) and C < O;
Condition5 = Value7 = Highest(Value7,Lookback) and C < O;
Condition6 = Value8 = Lowest(Value8,Lookback) and C < O;
Condition7 = Value9 = Lowest(Value9,Lookback) and C < O;
Condition8 = Value10 = Lowest(Value10,Lookback) and C > O;
Condition9 = Value11 = Lowest(Value11,Lookback) and C > O;
Condition10 = Value12 = Highest(Value12,Lookback);
If Use2Bars then begin
Condition11 = Value13 = Lowest(Value13,Lookback);
Condition12 = Value14 = Highest(Value14,Lookback) and C > O and C[1] > O[1];
Condition13 = Value15 = Highest(Value15,Lookback) and C > O and C[1] > O[1];
Condition14 = Value16 = Highest(Value16,Lookback) and C < O and C[1] < O[1];
Condition15 = Value17 = Highest(Value17,Lookback) and C < O and C[1] < O[1];
Condition16 = Value18 = Lowest(Value18,Lookback) and C < O and C[1] < O[1];
Condition17 = Value19 = Lowest(Value19,Lookback) and C < O and C[1] < O[1];
Condition18 = Value20 = Lowest(Value20,Lookback) and C > O and C[1] > O[1];
Condition19 = Value21 = Lowest(Value21,Lookback) and C > O and C[1] > O[1];
Condition20 = Value22 = Highest(Value22,Lookback);
End;
If BarType > 1 then begin
If LowVol and (Condition1 or Condition11) then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or Condition12 or Condition13 or Condition18 or Condition19) then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7 or Condition14 or Condition15 or Condition16 or Condition17) then BarColor = ClimaxDownColor;
If Churn and (Condition10 or Condition20) then BarColor = ChurnColor;
If ClimaxChurn and (Condition10 or Condition20) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or
Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) then BarColor = ClimaxChurnColor;
End;
If BarType <= 1 then begin
If LowVol and (Condition1 or (Condition11 and D=D[1])) then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or ((Condition12 or Condition13 or Condition18 or Condition19) and D=D[1])) then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7 or ((Condition14 or Condition15 or Condition16 or Condition17) and D=D[1])) then BarColor = ClimaxDownColor;
If Churn and (Condition10 or (Condition20 and D=D[1])) then BarColor = ChurnColor;
If ClimaxChurn and (Condition10 or (Condition20 and D=D[1])) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or
((Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) and D=D[1])) then BarColor = ClimaxChurnColor;
End;
Plot1(Value3,"Volume",BarColor);
If ShowAvg then Plot2(Average(Value3,200),"Avg",AvgColor);
{ Change Log: }
{23 November 2007  Added LowChurn colored volume bars }
{19 April 2008  Got rid of LowChurn and replaced with ClimaxDown }
{19 April 2008  Added open & close conditions with ClimaxUp and ClimaxDown }
{19 April 2008  Added different calculations for tick/intraday charts }
{26 June 2008  Added ability to turn average volume line on and off }
{5 July 2008  Changed Lookback from a variable to an input }
{13 July 2008  Added 2 bar climax, churn and low volume conditions }
{4 September 2008  Changed daily bars calculation to match tick/intraday }
{25 January 2009  Added condition total volume (Value3) could not be ve }
{19 August 2012  Changed calculation for Intraday + UseUpTicks = False }
Better Volume PaintBar
Inputs: LowVol(True), ClimaxUp(True), ClimaxDown(True), Churn(True), ClimaxChurn(False), LowVolColor(Yellow), ClimaxUpColor(Red), ClimaxDownColor(White), ChurnColor(Blue), ClimaxChurnColor(Magenta), Color(Green), UseUpTicks(True), Use2Bars(True);
Variables: BarColor(Green), Lookback(20);
BarColor = Color;
If BarType > 1 then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+OC))*V;
If C < O and Range <> 0 then Value1 = ((Range+CO)/(2*Range+CO))*V;
If C = O then Value1 = 0.5*V;
Value2 = VValue1;
End;
If BarType <= 1 and UseUpTicks = False then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+OC))*Ticks;
If C < O and Range <> 0 then Value1 = ((Range+CO)/(2*Range+CO))*Ticks;
If C = O then Value1 = 0.5*Ticks;
Value2 = TicksValue1;
End;
If BarType <= 1 and UseUpTicks then begin
Value1 = UpTicks;
Value2 = DownTicks;
End;
Value3 = AbsValue(Value1+Value2);
Value4 = Value1*Range;
Value5 = (Value1Value2)*Range;
Value6 = Value2*Range;
Value7 = (Value2Value1)*Range;
If Range <> 0 then begin
Value8 = Value1/Range;
Value9 = (Value1Value2)/Range;
Value10 = Value2/Range;
Value11 = (Value2Value1)/Range;
Value12 = Value3/Range;
End;
If Use2Bars then begin
Value13 = Value3+Value3[1];
Value14 = (Value1+Value1[1])*(Highest(H,2)Lowest(L,2));
Value15 = (Value1+Value1[1]Value2Value2[1])*(Highest(H,2)Lowest(L,2));
Value16 = (Value2+Value2[1])*(Highest(H,2)Lowest(L,2));
Value17 = (Value2+Value2[1]Value1Value1[1])*(Highest(H,2)Lowest(L,2));
If Highest(H,2) <> Lowest(L,2) then begin
Value18 = (Value1+Value1[1])/(Highest(H,2)Lowest(L,2));
Value19 = (Value1+Value1[1]Value2Value2[1])/(Highest(H,2)Lowest(L,2));
Value20 = (Value2+Value2[1])/(Highest(H,2)Lowest(L,2));
Value21 = (Value2+Value2[1]Value1Value1[1])/(Highest(H,2)Lowest(L,2));
Value22 = Value13/(Highest(H,2)Lowest(L,2));
End;
End;
Condition1 = Value3 = Lowest(Value3,Lookback);
Condition2 = Value4 = Highest(Value4,Lookback) and C > O;
Condition3 = Value5 = Highest(Value5,Lookback) and C > O;
Condition4 = Value6 = Highest(Value6,Lookback) and C < O;
Condition5 = Value7 = Highest(Value7,Lookback) and C < O;
Condition6 = Value8 = Lowest(Value8,Lookback) and C < O;
Condition7 = Value9 = Lowest(Value9,Lookback) and C < O;
Condition8 = Value10 = Lowest(Value10,Lookback) and C > O;
Condition9 = Value11 = Lowest(Value11,Lookback) and C > O;
Condition10 = Value12 = Highest(Value12,Lookback);
If Use2Bars then begin
Condition11 = Value13 = Lowest(Value13,Lookback);
Condition12 = Value14 = Highest(Value14,Lookback) and C > O and C[1] > O[1];
Condition13 = Value15 = Highest(Value15,Lookback) and C > O and C[1] > O[1];
Condition14 = Value16 = Highest(Value16,Lookback) and C < O and C[1] < O[1];
Condition15 = Value17 = Highest(Value17,Lookback) and C < O and C[1] < O[1];
Condition16 = Value18 = Lowest(Value18,Lookback) and C < O and C[1] < O[1];
Condition17 = Value19 = Lowest(Value19,Lookback) and C < O and C[1] < O[1];
Condition18 = Value20 = Lowest(Value20,Lookback) and C > O and C[1] > O[1];
Condition19 = Value21 = Lowest(Value21,Lookback) and C > O and C[1] > O[1];
Condition20 = Value22 = Highest(Value22,Lookback);
End;
If BarType > 1 then begin
If LowVol and (Condition1 or Condition11) then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or Condition12 or Condition13 or Condition18 or Condition19) then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7 or Condition14 or Condition15 or Condition16 or Condition17) then BarColor = ClimaxDownColor;
If Churn and (Condition10 or Condition20) then BarColor = ChurnColor;
If ClimaxChurn and (Condition10 or Condition20) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or
Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) then BarColor = ClimaxChurnColor;
End;
If BarType <= 1 then begin
If LowVol and (Condition1 or (Condition11 and D=D[1])) then BarColor = LowVolColor;
If ClimaxUp and (Condition2 or Condition3 or Condition8 or Condition9 or ((Condition12 or Condition13 or Condition18 or Condition19) and D=D[1])) then BarColor = ClimaxUpColor;
If ClimaxDown and (Condition4 or Condition5 or Condition6 or Condition7 or ((Condition14 or Condition15 or Condition16 or Condition17) and D=D[1])) then BarColor = ClimaxDownColor;
If Churn and (Condition10 or (Condition20 and D=D[1])) then BarColor = ChurnColor;
If ClimaxChurn and (Condition10 or (Condition20 and D=D[1])) and (Condition2 or Condition3 or Condition4 or Condition5 or Condition6 or Condition7 or Condition8 or Condition9 or
((Condition12 or Condition13 or Condition14 or Condition15 or Condition16 or Condition17 or Condition18 or Condition19) and D=D[1])) then BarColor = ClimaxChurnColor;
End;
If BarColor <> Color then PlotPaintBar(H,L,O,C,"BetterVol",BarColor);
{ Change Log: }
{23 November 2007  Added LowChurn colored volume bars }
{28 March 2008  Added ability to turn on and off different colored bars }
{28 March 2008  Got rid of redundant code calculations }
{19 April 2008  Got rid of LowChurn and replaced with ClimaxDown }
{19 April 2008  Added open & close conditions with ClimaxUp and ClimaxDown }
{19 April 2008  Added different calculations for tick/intraday charts }
{13 July 2008  Added 2 bar climax, churn and low volume conditions }
{4 September 2008  Changed daily bars calculation to match tick/intraday }
{25 January 2009  Added condition total volume (Value3) could not be ve }
{3 July 2009  Allowed the default bar coloring to be changed }
{19 August 2012  Changed calculation for Intraday + UseUpTicks = False }
