// Built for @ES 1 minute chart // Jonathan Kinlay // May 19 2014 // using elsystem; using elsystem.collections; Using elsystem.io ; Using tsdata.marketdata; using tsdata.common; input: Len(10), PTLVticks(30), PTSVticks(2), SLLVticks(2), SLSVticks(30), upperVolThreshold(3), lowerVolThreshold(0.25), StartTime(0800), EndTime(1515);//use exchange time on chart; var: BN(1), PT(0), SL(0), PTv(0.25), SLv(10), plusTrueRange(0), minusTrueRange(0), upsideVol(0), downsideVol(0), upsideFCSTVOL(0), downsideFCSTVOL(0); once clearprintlog; if date <> date[1] then begin BN = 1; end else begin BN += 1; If Close > Close[1] then begin upsideFCSTVOL = plusTrueRange + (plusTrueRange-plusTrueRange[1])*0.5; plusTrueRange = TrueRange; end; If Close < Close[1] then begin downsideFCSTVOL=minusTrueRange + (minusTrueRange-minusTrueRange[1])*0.5; minusTrueRange = TrueRange; end; if BN >= Len -1 and marketposition = 0 and time >= StartTime and upsideFCSTVOL > upperVolThreshold then begin buy("LE LV") 1 contracts next bar at Market; PT = PTLVticks; SL = SLLVticks; end; if BN >= Len - 1 and marketposition = 0 and time >= StartTime and downsideFCSTVOL > upperVolThreshold then begin sellshort("SE LV") 1 contracts next bar at Market; PT = PTLVticks; SL = SLLVticks; end; if BN >= Len -1 and marketposition = 0 and time >= StartTime and upsideFCSTVOL < lowerVolThreshold then begin SellShort("SE SV") 1 contract next bar at InsideAsk Limit; PT = PTSVticks; SL = SLSVticks; end; if BN >= Len -1 and marketposition = 0 and time >= StartTime and downsideFCSTVOL < lowerVolThreshold then begin Buy("LE SV") 1 contract next bar at InsideBid Limit; PT = PTSVticks; SL = SLSVticks; end; PTv = PT* Minmove/Pricescale; SLv = SL*Minmove/Pricescale; setprofittarget(PTv*bigpointvalue); setstoploss(SLv*bigpointvalue); setexitonclose; end;