Seattle, WA/USA
Experience: Intermediate
Platform: TOS, TS
Trading: Forex, crude
Posts: 96 since Sep 2016
Thanks Given: 7
Thanks Received: 35
prelate
Hi All,
any assistance or guidance would be GREATLY appreciated.
I'm trying to convert a PaintBar/indicator to a strategy.
The paintbar/indicator is from the emini-watch site (paintbar and indicator versions are available).
it's one of the free indicators available there.
https://emini-watch.com/free-stuff/volume-indicator/
The paintbar highlights bars according to volume type. The indicator does the same on its own subgraph.
I'd like to convert it to a strategy. Buy when ClimaxUp is true. Sell upon another condition.
my rudimentary
easylanguage skills usually let me do this with indicators but this is beyond me. Any help or pointing in the right direction is appreciated.
original paintbar/indicator is available attached or directly from the eminiwatch site linked above
thanks!
here you go.
Code
{***** Copyright www.Emini-Watch.com All rights reserved *****
Converted to strat for futures.io request by The_PNW_Yeti
{******************************* 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/intra-day charts }
{13 July 2008 - Added 2 bar climax, churn and low volume conditions }
{4 September 2008 - Changed daily bars calculation to match tick/intra-day }
{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 Intra-day + UseUpTicks = False }
}
Inputs: UseUpTicks(True), Use2Bars(True);
Variables: climaxup (false), BarColor(Green), Lookback(20);
If BarType > 1 then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+O-C))*V;
If C < O and Range <> 0 then Value1 = ((Range+C-O)/(2*Range+C-O))*V;
If C = O then Value1 = 0.5*V;
Value2 = V-Value1;
End;
If BarType <= 1 and UseUpTicks = False then begin
If C > O and Range <> 0 then Value1 = (Range/(2*Range+O-C))*Ticks;
If C < O and Range <> 0 then Value1 = ((Range+C-O)/(2*Range+C-O))*Ticks;
If C = O then Value1 = 0.5*Ticks;
Value2 = Ticks-Value1;
End;
If BarType <= 1 and UseUpTicks then begin
Value1 = UpTicks;
Value2 = DownTicks;
End;
Value3 = AbsValue(Value1+Value2);
Value4 = Value1*Range;
Value5 = (Value1-Value2)*Range;
Value6 = Value2*Range;
Value7 = (Value2-Value1)*Range;
If Range <> 0 then begin
Value8 = Value1/Range;
Value9 = (Value1-Value2)/Range;
Value10 = Value2/Range;
Value11 = (Value2-Value1)/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]-Value2-Value2[1])*(Highest(H,2)-Lowest(L,2));
Value16 = (Value2+Value2[1])*(Highest(H,2)-Lowest(L,2));
Value17 = (Value2+Value2[1]-Value1-Value1[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]-Value2-Value2[1])/(Highest(H,2)-Lowest(L,2));
Value20 = (Value2+Value2[1])/(Highest(H,2)-Lowest(L,2));
Value21 = (Value2+Value2[1]-Value1-Value1[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 ( Condition12 or Condition13 or Condition18 or Condition19) then climaxup = true else climaxup = false;
End;
If BarType <= 1 then begin
If (Condition2 or Condition3 or Condition8 or Condition9 ) then climaxup = true else climaxup = false;
end;
If climaxup then buy next bar at open;