[LegacyColorValue = true];
Inputs: Price(Close), Avg1(3), Avg2(10), Avg3(16), StdDsp(1), UpColor( DarkGreen), DnColor( DarkRed), ZeroColor( Red ); IF Currentbar>30 Then Begin IF StdDsp=1 Then Value1=Average(Price,Avg1)-Average(Price,Avg2); IF StdDsp<>1 Then Value1=Average((Price-(Average(Price,3)[3])), 2);
Value11 = value1;
Value2=Average(Value1,Avg3);
Plot1(Value1,"3/10Line"); Plot2(Value2,"16Line"); Plot3(0,"ZeroLine", DarkGray ); plot4(Value11,"3/10Line_2", DarkGray); { Color criteria }
if Value1 >= 0 then SetPlotColor(1,UpColor);if Value1 <= 0 then SetPlotColor(1,DnColor);
End;
Showing posts with label Indicators. Show all posts
Showing posts with label Indicators. Show all posts
Saturday, July 18, 2009
Wednesday, March 11, 2009
Tick To Minutes Histogram EL Code
if (BarType = 0) then begin { tick bars }
end;
if date = date[1] then begin
value1 = (TimeToMinutes(time)-TimeToMinutes(time[1]));
if value1<=15 then plot1(value1,"tick time");
if value1>15 then plot2(15,"15");
plot3(5,"5");
end;
{to not distort the chart, any reading higher than 15 mins gets set to 15-minutes -- so really slow markets will be slightly overstated 'down' to 15 minutes}
Thursday, July 17, 2008
Ticks To Min Indicator, JJ
This indicator for tick charts displays the average time between bars for the last x bars (default is 5).
//jh_time_2_min
input: numbars(5);
vars: lasttime(0), firsttime(0), timediff(0), timetext(0);
once timetext = Text_New(0,0, 0, NumToStr(timediff, 1));
timediff = (TimeToMinutes(Time[1]) - TimeToMinutes(Time[numbars + 1]))/numbars;Text_SetString(timetext, NumToStr(timediff, 1)+ " min");
value1 = Text_Float(timetext, 0, 2);
//jh_time_2_min
input: numbars(5);
vars: lasttime(0), firsttime(0), timediff(0), timetext(0);
once timetext = Text_New(0,0, 0, NumToStr(timediff, 1));
timediff = (TimeToMinutes(Time[1]) - TimeToMinutes(Time[numbars + 1]))/numbars;Text_SetString(timetext, NumToStr(timediff, 1)+ " min");
value1 = Text_Float(timetext, 0, 2);
Wednesday, June 11, 2008
Hi-Low Bars

Inputs: HiColor(darkgreen), LoColor(red);
Variables: DHigh(0), DLow(0);
If Date <> Date[1] then begin //High and low of 1st bar of the day are captured
DHigh = High;
DLow = Low;
Value1 = Text_New(Date, Time, High, NumToStr(High, 2)); //Text with high and low are placed above
Value2 = Text_New(Date, Time, Low, NumToStr(Low, 2)); //and below, respectively, the 1st bar of each day
Text_SetStyle(Value1, 2, 1);
Text_SetColor(Value1, HiColor);
Text_SetStyle(Value2, 2, 0);
Text_SetColor(Value2, LoColor);
end
else begin //Subsequent bars' highs and lows are captured if they exceed
If High > DHigh and Value1 >= 1 then begin //the highs and lows of the 1st bar of the day
DHigh = High;
Text_SetLocation(Value1, Date, Time, High); //If there are new highs or lows that day, then the text objects for that
Text_SetString(Value1, NumToStr(High, 2)); //day are moved, and changed to read the new high and low
end;
If Low < DLow and Value2 >= 1 then begin
DLow = Low;
Text_SetLocation(Value2, Date, Time, Low);
Text_SetString(Value2, NumToStr(Low, 2));
end;
end;
Sunday, March 30, 2008
Synthetic VIX Future for TS

Since TradeStation doesn't support VIX futures, here is a way to keep track of the near term future premium. Using put/call parity, you can construct a synthetic VIX future from option prices (close enough for our purposes - no need to present value this calc because rates are low and time to exp is short).
Insert symbol $VIX.X as data1, VIX DE as data2, VIX PE as data3
You can hide data2 and data3 (these are the near term call and put symbols, respectively.
This indicator plots the call and put combo (basically a synthetic future) premium/discount to the VIX cash index. The two inputs are the strike price, in this case, 25 and ArbValue(.85) which changes the color from white to red (sell) or green (buy).
Each month, you have to switch the options to the next month and keep the options around the money, ie, if the vix goes to around 30, use the 30 options. Hope this helps.
JJ
{JH_Synth_VIX_Fut}
inputs: StrikePrice(25), ArbValue(.85);
var: CallAvg(0), PutAvg(0), diff(0);
CallAvg = (insidebid of data2 + insideask of data2)/2;
PutAvg = (insidebid of data3 + insideask of data3)/2;
diff = CallAvg - PutAvg + strikeprice - close data1;
setplotcolor(1, white);
if diff > ArbValue then setplotcolor(1,red);
if diff < -ArbValue then setplotcolor(1,green);
Plot2(0);
Plot1(diff, "SynthFuture");
Subscribe to:
Posts (Atom)