This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LongS10Projection (0);{used for exits on entry candle}
Variables:
S10atEntry(0),
LossCounter (0),
WinCounter (0),
NumLoss (0),
NumWin(0);
NumLoss= NumLosTrades;
NumWin= NumWinTrades;
If NumLoss > NumLoss[1] then LossCounter = LossCounter + 1;
If NumWin > NumWin[1] then WinCounter = WinCounter + 1;
If Time < 800 then LossCounter = 0;
If Time < 800 then WinCounter = 0;
{SESSION HIGH & LOW}
Variables:
SessionHigh (0),
SessionLow (0),
SessionRange (0),
SessionRangeLimit(7);
If Time = 0 then begin
SessionHigh =High;
SessionLow =Low;
End;
If High > SessionHigh then SessionHigh = High;
If Low < SessionLow then SessionLow = Low;
SessionRange = SessionHigh - SessionLow;
Variables:
InPositionBarCount (0);
{IN POSITION BAR COUNTER}
If Marketposition = 0 then
InPositionBarCount = 0;
If Marketposition <>0 then
InPositionBarCount = InPositionBarCount + 1;
Variables:
S10Entry.a (0),
S10Entry.b (0),
S10Entry.c (0),
S10Entry.d (0),
S10Entry.e (0),
S10Entry.f (0),
S10Entry.g (0),
S10Entry.h (0),
ERCEntry.a (0),
ERCEntry.b (0),
ERCEntry.c (0),
ERCEntry.d (0),
ERCEntry.e (0),
ERCEntry.f (0),
ERCEntry.g (0),
ERCEntry.h (0),
ERCEntry.i (0)
;
If Marketposition = 0 then begin
S10Entry.a = 0;
S10Entry.b = 0;
S10Entry.c = 0;
S10Entry.d = 0;
S10Entry.e = 0;
S10Entry.f = 0;
S10Entry.g = 0;
S10Entry.h = 0;
ERCentry.a = 0;
ERCentry.b = 0;
ERCentry.c = 0;
ERCentry.d = 0;
ERCentry.e = 0;
ERCentry.f = 0;
ERCentry.g = 0;
ERCentry.h = 0;
ERCentry.i = 0;
End;
Variables:
LtOpen (0);
If Time = 800
Or Time = 830
Or Time = 900
Or Time = 930
Or Time = 1000
Or Time = 1030
Or Time = 1100
Or Time = 1130
Or Time = 1200
Or Time = 1230
Or Time = 1300
Or Time = 1330
Or Time = 1400
Or Time = 1430
Or Time = 1500
Then LTOpen = Open;
Variables:
PredictedS10 (0),
S10TrendCount (0);
If S10 > S10[1]
Then PredictedS10 = S10 + (S10 -S10[1]);
If S10 < S10[1]
Then PredictedS10 = S10 - (S10[1] -S10);
If S10 > S10[1]
And S10TrendCount < 0
Then S10TrendCount = 0;
If S10 < S10[1]
And S10TrendCount > 0
Then S10TrendCount = 0;
If S10 > S10[1]
Then S10TrendCount = S10TrendCount + 1;
If S10 < S10[1]
Then S10TrendCount = S10TrendCount - 1;
{**************Paul for all longs, write a Bias test for the open that cancels as soon as 2 pt counter or GB w/bias. If mixed stay out for some time or movement}
{***************** on the open of the 8:25 candle of 1/2/15 a long S-10 trade was executed 1 pt below Bounceline}
{***************** theres a trade on 12/28/12 that sucks}
And (Highest (high,5) - Low < 3.5 or S10> S10[1]+.55)
And Highest (high,5) - Low > 1
And Low[1] >= S10 [1]
And low[2] >= S10 [2]
And S10TrendCount >0
And AbsValue((Highest (high,10)- GlobexHigh)) > 0.5
And AbsValue((Highest (high,10)- PP)) > 0
And PredictedS10 + S10Range < GlobexHigh - 1
And PredictedS10 > DownsideTarget1
Then begin
Buy ("(L)S10<GBH") 4 contracts next bar at PredictedS10 + S10Range limit;
S10Entry.a= PredictedS10 + S10Range;
End;
{scale out}
Sell ("+S10.GH.a") From Entry ("(L)S10<GBH") 1 contracts Next Bar at GlobexHigh - .5 limit;
Sell ("+S10.T1.a") From Entry ("(L)S10<GBH") 1 contracts Next Bar at UpsideTarget1 - .5 limit;
Sell ("+S10.T2.a") From Entry ("(L)S10<GBH") 1 contracts Next Bar at UpsideTarget2 - .5 limit;
If S1 > UpsideTarget2 + 1.5 then Sell ("+S10.S1.a") From Entry ("(L)S10<GBH") 1 contracts Next Bar at R1 - .5 limit;
If S2 > UpsideTarget2 + 1.5 then Sell ("+S10.S2.a") From Entry ("(L)S10<GBH") 1 contracts Next Bar at R2 - .75 limit;
If S3 > UpsideTarget2 + 1.5 then Sell ("+S10.S3.a") From Entry ("(L)S10<GBH") 1 contracts Next Bar at R3 - .75 limit;
{Globex Low stop *************************************NOT SURE WE NEED THIS GIVEN THE STOP OUT CODE BELOW}
If S10Entry.a > GlobexLow + 1
And S10Entry.a - Close < 2
then
Sell ("+S10.GBL.stop") From Entry ("(L)S10<GBH") all contracts Next Bar at GlobexLow - .25 stop;
{S10 PreHook}
If High < S10
and (Close < Open - .5 or time > 1430 or High - Close > 1)
then sell ("+S10 pre-hook.a") from Entry ("(L)S10<GBH") all contracts next bar at PredictedS10 limit;
{get safe}
If Currentcontracts <> 0
Then Begin
If Currentcontracts < 4
And GlobexHigh - Entryprice > 2.25
then Sell ("+S10.SafeStop.a") From Entry ("(L)S10<GBH") all contracts next bar at EntryPrice - .25 stop; {optomized 12/22 at -.25}
If Currentcontracts < 4
And GlobexHigh - Entryprice <= 2.25
then Sell ("+S10.SafeStop.b") From Entry ("(L)S10<GBH") all contracts next bar at EntryPrice - (GlobexHigh -.5 - EntryPrice) +.25 stop; {optomized 12/22 at +.25}
If Currentcontracts < 3
And Close[1]> open[1]
And Close < Low[1]
And Close < S19
then Sell ("+S10.SafeStop.h") From Entry ("(L)S10<GBH") all contracts next bar at S19- 1 stop;
{stop out}
Sell ("+S10<GBH.Stopout") From Entry ("(L)S10<GBH") all contracts Next Bar at EntryPrice - 5.75 stop; {******************Matt, I added this, optomized at 5.75, about same as master stop }
End;
{===============END LONG S10 ENTRIES below Globex High===============}
And MyMACD_30 > - .2 {added this line 1.03.15, added $200}
And LTopen > S10_30 -1
And AbsValue(PP - GlobexLow) > 1.5 {**************matt, on 12/27/12 the PP is 1.75 pts above bounceline, we get stopped out, trying to restrict entries with PP just above BL, my code isn't doing that but it helped somewhere else}
{***********just for the heck of it, can you also take this same trade on a open at the UpsideTarget1 and test it}
If Marketposition = 0
And time > 830
And time < 840
And GlobexHigh - Bounceline > 2
And Close <= GlobexHigh - .5
And Highest (high,3) > GlobexHigh + .75
Then begin
Sellshort ("(S)Scalp") 4 contracts next bar at GlobexHigh - .75 limit;
End;
{scale out}
Buytocover ("-Scalp.GL") From Entry ("(S)Scalp") 2 contracts Next Bar at GlobexLow + .5 limit;
Buytocover ("-Scalp.T1") From Entry ("(S)Scalp") 1 contracts Next Bar at DownsideTarget1 + .5 limit;
Buytocover ("-Scalp.T2") From Entry ("(S)Scalp") 0 contracts Next Bar at DownsideTarget2 + .75 limit;
If Entryprice <> 0 then Buytocover ("-Scalp.15pointer") From Entry ("(S)Scalp") all contracts Next Bar at EntryPrice - 15 limit;
If S1 < DownsideTarget2 Then Buytocover ("-Scalp.S1") From Entry ("(S)Scalp") 1 contracts Next Bar at S1 + .5 limit;
If S2 < DownsideTarget2 Then Buytocover ("-Scalp.S2") From Entry ("(S)Scalp") 1 contracts Next Bar at S2 + .5 limit;
If S3 < DownsideTarget2 Then Buytocover ("-Scalp.S3") From Entry ("(S)Scalp") 1 contracts Next Bar at S3 + .75 limit;
{get safe}
If Currentcontracts <> 0
Then begin
If Currentcontracts < 4
then Buytocover ("-Scalp.SafeStop") From Entry ("(S)Scalp") all contracts Next Bar at Bounceline + .75 stop;
{stop out}
Buytocover ("-Scalp.Stopout") From Entry ("(S)Scalp") all contracts Next Bar at GlobexHigh + .75 stop;
End;
{00000000000000000000000=======END OF SHORT SCALP ENTRY=======000000000000000000}
{*******10.02.14 at 9:10. That wick which is an E-1 probe meant to knock out anyone shorting, then it takes off, is a common thing. Can you think of a way to code for allowance of one wick of .75?}
{missing great trade on 3/15/13 for reference, for many reasons}
And Lowest(low,10) < Bounceline - 4 {**********this line read "highest high" which is wrong, changed it to lowest low and optomized at -4 which seems way too high, optomized on 1.03.15}
And AbsValue(Lowest(low,10) - GlobexLow) > 1.75 {**********this line optomized from .75 to 1.75 on 1.03.15}
And MyMACD < 0
And AbsValue(PP - GlobexLow) > 1.25
And (Bounceline - GlobexLow > 2.5) {added these next 2 line on 1.03.15}
And LTopen < S10_30 + .5
{And S10 < S10[1] + .75
And S10 > Bounceline +3}
Then begin
Sellshort ("(S)BL") 4 contracts next bar at Bounceline - .75 limit; {optomized at .75 on 01/03}
End;
{scale out}
Buytocover ("-BL.GL") From Entry ("(S)BL") 1 contracts Next Bar at GlobexLow + .5 limit;
Buytocover ("-BL.T1") From Entry ("(S)BL") 1 contracts Next Bar at DownsideTarget1 + .5 limit;
Buytocover ("-BL.T2") From Entry ("(S)BL") 1 contracts Next Bar at DownsideTarget2 + .75 limit;
Buytocover ("-BL.10pointer") From Entry ("(S)BL") 1 contracts Next Bar at Bounceline - 10 limit;
If S1 < DownsideTarget2 - 1.5 then Buytocover ("-BL.S1.f") From Entry ("(S)BL") 1 contracts Next Bar at S1 + .5 limit; {added these 3 lines 01.03.15}
If S2 < DownsideTarget2 - 1.5 then Buytocover ("-BL.S2.f") From Entry ("(S)BL") 1 contracts Next Bar at S2 + .75 limit;
If S3 < DownsideTarget2 - 1.5 then Buytocover ("-BL.S3.f") From Entry ("(S)BL") 1 contracts Next Bar at S3 + .75 limit;
{get safe}
If Currentcontracts <> 0
Then begin
If Currentcontracts < 4
then Buytocover ("-BL.SafeStop") From Entry ("(S)BL") all contracts Next Bar at Bounceline + 2 stop; {optomized at 2 on 12/19}
End;
{stop out}
Buytocover ("-BL.FullStop") From Entry ("(S)BL") all contracts Next Bar at Bounceline + 2 stop; {makes a $1200 difference if this is in code before get safe below, optomized at 2 on 12/19}
{00000000000000========END OF SHORT BOUNCE TRADES======00000000000}
Sellshort ("(S)Z-BL") 4 contracts next bar at Bounceline - .75 limit;
End;
{scale out}
Buytocover ("-(S)Z-BL.T1") From Entry ("(S)Z-BL") 1 contracts Next Bar at DownsideTarget1 + .75 limit;
Buytocover ("-(S)Z-BL.T2") From Entry ("(S)Z-BL") 1 contracts Next Bar at DownsideTarget2 + .75 limit;
Buytocover ("-Z-BL.15pointer") From Entry ("(S)Z-BL") 2 contracts Next Bar at Bounceline - 15 limit;
If S2 < DownsideTarget2 Then Buytocover ("-(S)Z-BL.R2") From Entry ("(S)Z-BL") 1 contracts Next Bar at S2 + .75 limit;
If S3 > DownsideTarget2 Then Buytocover ("-(S)Z-BL.R3") From Entry ("(S)Z-BL") 1 contracts Next Bar at S3 + .75 limit;
{get safe}
If Currentcontracts <> 0
Then begin
If Currentcontracts < 4
then Buytocover ("-(S)Z-BL.SafeStop") From Entry ("(S)Z-BL") all contracts Next Bar at Bounceline + 1 stop;
End;
{stop out}
Buytocover ("-(S)Z-BL.Stopout") From Entry ("(S)Z-BL") all contracts Next Bar at Bounceline + 2.25 stop;
{00000000000000========END OF SHORT Z-PATTERN Bounceline ENTRY======00000000000}
{00000000000000========SHORT Z-PATTERN OFF GLOBEX LOW ENTRY ======00000000000}
If Marketposition = 0
And Time >= 825
And Time < 1430
And Open < GlobexLow + .75
And Close < GlobexLow
And High > GlobexLow - 1
And High < GlobexLow +1
And GlobexLow - DownsideTarget1 > 1.75
And Lowest(low,5) < GlobexLow - 2
And Highest(high,20) > GlobexLow + 1.25
And (S10 > GlobexLow + 1)
And LTopen < S10_30 + 1.25 {1.2.15 was 0 but caught beautiful trade with + 1.25 on 1.2.15, cost 300 though}
And S10_30 < S10_30[1]
And MyMACD_30 < - .2
Then begin
Sellshort ("(S)Z-GBL") 4 contracts next bar at GlobexLow - .75 limit;
End;
{scale out}
Buytocover ("-Z-GBL.T1") From Entry ("(S)Z-GBL") 2 contracts Next Bar at DownsideTarget1 + .5 limit;
Buytocover ("-Z-GBL.T2") From Entry ("(S)Z-GBL") 1 contracts Next Bar at DownsideTarget2 + .75 limit;
Buytocover ("-Z-GBL.10pointer") From Entry ("(S)Z-GBL") 1 contracts Next Bar at GlobexLow - 11 limit;
{get safe}
If Currentcontracts <> 0
Then begin
If Currentcontracts < 4
then Buytocover ("-Z-GBL.SafeStop") From Entry ("(S)Z-GBL") all contracts Next Bar at GlobexLow + .75 stop;
End;
{stop out}
Buytocover ("-Z-GBL.Stopout") From Entry ("(S)Z-GBL") all contracts Next Bar at GlobexLow + 1 stop; {********Matt I added and optomized this line,at 1.75 on 12.30}
{00000000000000========END OF SHORT Z OF GLOBEXLOW ENTRY======00000000000}
Sellshort ("(S)S10>T2") 4 contracts next bar at PredictedS10 - S10Range limit;
S10Entry.g= PredictedS10 - S10Range;
End;
{scale out}
Buytocover ("-S10.T2.g") From Entry ("(S)S10>T2") 1 contracts Next Bar at DownsideTarget2 + .5 limit;
If S1 < S10Entry.g - 1.5 then Buytocover ("-S10.S1.g") From Entry ("(S)S10>T2") 1 contracts Next Bar at S1 + .5 limit;
If S2 < S10Entry.g - 1.5 then Buytocover ("-S10.S2.g") From Entry ("(S)S10>T2") 1 contracts Next Bar at S2 + 1.25 limit; {****this exit not working on 12/10 at 14:10}
If S3 < S10Entry.g - 1.5 then Buytocover ("-S10.S3.g") From Entry ("(S)S10>T2") 1 contracts Next Bar at S3 + .75 limit;
{S10 PreHook}
If Low > S10
and (Close > Open + .5 or time > 1430 or Close - Low > 1)
then Buytocover ("-S10 pre-hook.g") from Entry ("(S)S10>T2") all contracts next bar at PredictedS10 limit;
{get safe}
If Currentcontracts <> 0
Then Begin
If Currentcontracts < 4
And S10Entry.g - DownsideTarget2 > 2.25
then Buytocover ("-S10.SafeStop.g") From Entry ("(S)S10>T2") all contracts next bar at S10Entry.g + 1 stop;
End;
{stop out}
Buytocover ("-S10.Stopout.g") From Entry ("(S)S10>T2") all contracts Next Bar at S10Entry.g + 4 stop;
{000000000000000000=======END SHORT S10 ENTRIES above Upside Target 2========000000000000000000}