본문 바로가기
선물옵션/선물옵션 일반

signal

by 잠실돼지2 2022. 9. 11.
-

-
Gary Smith S&P500 signal


{System: "=GS Mod#2 1996 input"
The Modified Gary Smith System #2 (effective Jan. 1996)
   by Gary Smith.
This version has inputs for the various time and price parameters.

Programming code written by
Richard Saidenberg
35 Tamarack Way
Pleasantville, NY 10570 -- phone 914-948-7775.  
Copyright @ 1995 by Richard Saidenberg}

{Use TradeStation Built in Stop:
  *Close all trades at end of day session.  }


INPUT:TOFFSET(0),MM170(1.70),TRL275(2.75),TRL225(2.25),
  UD450(4.50),PPROF600(600),OPLUS100(1.00),
  TIME1(920),TIME2MON(1145),TIME2TT(1100),
  TIME2WF(1030),TIME3WF(1100),
  TUESFILT(0.60),THFRFILT(1.00),THFRFTIM(845);

VAR:MP(0),DW(0),UD400(FALSE),PREVCX(0),GO(FALSE),
  PDATE(0),PPROF(0),PFILTER(FALSE),OPTODAY(OPEN),
  EARLYH(0),TOF(0),
  TUESFILTER(FALSE),THUFRIFILTER(FALSE),HOLIDAY(FALSE),
  WFENTRY1(99999),WFENTRY2(99999);

MP=MARKETPOSITION;
TOF=100*TOFFSET;
DW=DAYOFWEEK(D);
IF MP=1 THEN BEGIN
  EXITLONG("MM Stop 1.70") ENTRYPRICE-MM170 STOP;
  IF {DW=1 OR} DW=2 THEN EXITLONG("Trail 2.75") IDHIGH-TRL275 STOP;
  IF DW=3 OR DW=4 OR DW=5 THEN EXITLONG("Trail 2.25") IDHIGH-TRL225 STOP;
END;

IF D>D[1] THEN BEGIN
  HOLIDAY=(DW=1 AND DW[1]<>5) OR
                   (DW=2 AND DW[1]<>1) OR
                   (DW=3 AND DW[1]<>2) OR
                   (DW=4 AND DW[1]<>3) OR
                   (DW=5 AND DW[1]<>4);
  UD400=ABSVALUE(C[1]-PREVCX)<UD450 OR HOLIDAY;
  TUESFILTER=C[1]-PREVCX<TUESFILT OR HOLIDAY;
  THUFRIFILTER=TRUE;
  PREVCX=C[1];
  GO=TRUE;
  OPTODAY=OPEN;
  PDATE=ENTRYDATE(1);
  PPROF=(POSITIONPROFIT(1)+(SLIPPAGE+COMMISSION));
  PFILTER=PDATE<>D[1] OR PPROF<PPROF600 OR HOLIDAY;
  WFENTRY1=99999;
END;
IF ENTRYDATE=D THEN GO=FALSE;
IF T[1]<TIME1+TOF AND T>=TIME1+TOF THEN EARLYH=IDHIGH;
IF T[1]<THFRFTIM+TOF AND T>=THFRFTIM+TOF AND
   IDLOW<=OPTODAY-THFRFILT THEN THUFRIFILTER=FALSE;

{===MONDAY===================================}
IF DW=1 AND T>=TIME1+TOF AND T<TIME2MON+TOF AND GO THEN
  BUY("Mon Buy") IDHIGH-0.05 STOP;

{===TUESDAY===================================}
IF DW=2 AND T>=TIME1+TOF AND T<TIME2TT+TOF AND
  GO AND TUESFILTER AND PFILTER AND UD400 THEN
    BUY("Tue Buy") IDHIGH-0.05 STOP;

{===WEDNESDAY================================}
IF DW=3 AND GO AND PFILTER AND UD400 THEN BEGIN
  IF T>=TIME3WF+TOF THEN BEGIN
    WFENTRY1=99999;WFENTRY2=99999;END;
  IF (T>=TIME1+TOF AND T<TIME2WF+TOF) OR
    (T>=TIME2WF+TOF AND T<TIME3WF+TOF AND IDHIGH>EARLYH) THEN
      WFENTRY1=MAXLIST(IDHIGH+0.05,OPTODAY+OPLUS100);
  IF T>=TIME2WF+TOF AND T<TIME3WF+TOF AND IDHIGH=EARLYH THEN BEGIN
    WFENTRY2=IDHIGH+0.05;
    IF WFENTRY2<WFENTRY1 THEN BUY("Wed Buy#2") WFENTRY2 STOP;
  END;
  IF WFENTRY1<99999 THEN BUY("Wed Buy#1") WFENTRY1 STOP;
END;

{=== THURSDAY===============================}
IF DW=4 AND T>=TIME1+TOF AND T<TIME2TT+TOF AND THUFRIFILTER AND
  GO AND PFILTER AND UD400 THEN
    BUY("Thu Buy") IDHIGH+0.05 STOP;

{===FRIDAY==================================}
IF DW=5 AND GO AND THUFRIFILTER AND UD400 THEN BEGIN
  IF T>=TIME3WF+TOF THEN BEGIN
    WFENTRY1=99999;WFENTRY2=99999;END;
  IF (T>=TIME1+TOF AND T<TIME2WF+TOF) OR
    (T>=TIME2WF+TOF AND T<TIME3WF+TOF AND IDHIGH>EARLYH) THEN
      WFENTRY1=MAXLIST(IDHIGH+0.05,OPTODAY+OPLUS100);
  IF T>=TIME2WF+TOF AND T<TIME3WF+TOF AND IDHIGH=EARLYH THEN BEGIN
    WFENTRY2=IDHIGH+0.05;
    IF WFENTRY2<WFENTRY1 THEN BUY("Fri Buy#2") WFENTRY2 STOP;
  END;
  IF WFENTRY1<99999 THEN BUY("Fri Buy#1") WFENTRY1 STOP;
END;

-
Catscan signal


Vars: ChoppyMarket(False), XMA1(0), XMA2(TrickXavg); 

ChoppyMarket =  -ChopLimits <= ChoppyIndex and ChoppyIndex <= +ChopLimits; {TRUE IF CHOPPY MARKET}

              { *** CALCULATE DAILY XAVERAGE OF DAILY TRUE RANGES ***}
XMA1 = 0.818*XMA2+ 0.182*TrueRange;     {CHOPPY MKT  XAVG OF DAILY RANGES}
XMA2 = 0.818*XMA1 + 0.182*TrueRange;     {TRENDY MKT  XAVG OF DAILY RANGES}       

                        { *** CHOPPY MARKET ENTRY SIGNALS ***    }
If ChoppyMarket then Buy("ChoppyBuy") Tomorrow at Open of Tomorrow+1.25*XMA1 Stop; 
If ChoppyMarket then Sell("ChoppySell") Tomorrow at Open of Tomorrow-1.25*XMA1 Stop;


                       { *** TRENDY MARKET ENTRY SIGNALS ***}
If ChoppyIndex> ChopLimits then Buy("BullBuy") Tomorrow at Open of Tomorrow+0.50*XMA2 Stop;           
If ChoppyIndex< -ChopLimits then Sell("BearSell") Tomorrow at Open of Tomorrow-0.50*XMA2 Stop;  

                   { *** CHANNEL BREAKOUT ENTRY SIGNALS ***}
Buy("ChannelBuy")   Tomorrow at the Highest(TrueHigh,40) + 1 Point Stop;
Sell("ChannelSell") Tomorrow at the   Lowest(TrueLow,40)  - 1 Point Stop; 




-
JK-20-SC-USBB signal

Input: VarA(5);
IF C >C[1]  Then Buy C + (Range*0.9) Stop;
IF MarketPosition=1 and BarsSinceEntry>=VarA-1 
Then ExitLong at Market;
IF C < C[1]  Then Sell C-(Range *1.8) Stop;
IF MarketPosition=-1 and BarsSinceEntry>=VarA-1
 Then ExitShort at Market;


if Date > Date[1] then begin
PRINT(file("C:\pa\20"),
DATE:6:0,",",
DayOfWeek(date):1:0,",",
CurrentTime:4:0,",",
OpenPositionProfit+NetProfit,",",
NetProfit,",",
MaxidDrawdown,",",
MarketPosition:1:0);

END;

-
MasterSuite S&P  signal


{IMPORTANT! You must have at least sixty (60) days data preceeding the start of the contract you are trading to generate accurate signals. CSI end-of-day is the recommended data provider for the most accurate signals}

{The following line sets default variable settings for the S&P Index.}

Inputs: Ltrend(60), Strend(15), ValuRise(2000), MaxLDD(4000), 
     MaxSDD(3000), maxloss(10000), rollday(25), 
     OldCM(1), OldExPos(0), whip(10);


{General rollover information:
    rollday = day of month for rollover on close
    OldCM = contract month FROM which you rolled over into 
                       the current contract
    OldExPos = your market position (1 = long, -1 = short,
                       0 = flat) in the old contract when you rolled
                       over into the current contract
    Value2 = 0 before start of trading in contract
    Value2 = -2 on day of rollover into contract
    Value2 = 2 during trading period in contract
    Value2 = 1 on day of rollover out of contract
    Value2 = -1 after rollover out of contract}

{ Initialize Value2 to current trading period }
Value2 = 2;


{References to "deliveryyear + 69" instead of "deliveryyear" and to
"deliveryyear + 68" instead of "deliveryyear - 1" are to compensate
for a bug in TradeStation which apparently reads 1969 as the zero
delivery year.  This code may have to be changed if this bug is 
corrected in future releases of TradeStation.}

{The following series of lines set a flag to roll OUT of the CURRENT
contract}

{On day after rollover out and subsequent days, set Value2 
negative (= -1) to prevent any spurious trades in the old contract}

if value2 = 1 then value2 = -1;

{Set Value2 = 1 on day before rollover out of this contract when 
rollover is to be on 25th of month or last trading day before 25th; 
this is for months where no holidays fall on 25th}

if year(date of today) = deliveryyear
    and month(date of today) = deliverymonth - 1 
    and  month(date of today) <> 5 and  month(date of today) < 11 
    and rollday = 25 then begin
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) < 6 then Value2 = 1;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = 1;
end;

{Account for case in which Memorial Day may be May 25}

if year(date of today) = deliveryyear
    and month(date of today) = 5 and deliverymonth = 6 
    and rollday = 25 then begin
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) < 6 then Value2 = 1;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 22 
        and dayofweek(date of today) = 5 then Value2 = 1;
end;

{Account for case in which Thanksgiving may be November 25}

if year(date of today) = deliveryyear
    and month(date of today) = 11 and deliverymonth = 12
    and rollday = 25 then begin
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) < 4 then Value2 = 1;
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 3 then Value2 = 1;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = 1;
end;

{Account for fact that December 25 is not a trading day}

if year(date of today) = deliveryyear - 1
    and month(date of today) = 12 and deliverymonth = 1 
    and rollday = 25 then begin
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) < 6 then Value2 = 1;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 22 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = 21 
        and dayofweek(date of today) = 5 then Value2 = 1;
end;

{Allow user to set manually a rollover date other than the 25th of
the month} 

if ((year(date of today) = deliveryyear
    and month(date of today) = deliverymonth - 1) or  
    (month(date of today) = 12 and  deliverymonth = 1 and 
    year(date of today) = deliveryyear -1)) and rollday <> 25 
    then begin
        if dayofmonth(date of today) = rollday  
        and dayofweek(date of today) < 6 then Value2 = 1;
        if dayofmonth(date of today) = rollday - 1 
        and dayofweek(date of today) = 5 then Value2 = 1;
        if dayofmonth(date of today) = rollday - 2 
        and dayofweek(date of today) = 5 then Value2 = 1;
end;

{Roll out of current contract on rollover day on close}

if value2 = 1 then exitlong today close;
if value2 = 1 then exitshort today close;

{This is the end of the series of lines which set a flag to roll OUT
of the CURRENT contract, and perform the roll out.}


{The following series of lines incorporate the signal to start trading
in the current contract on the specified rollover date from the previous 
contract, and prevent spurious trades in the current contract before
the date you rolled over into this contract.}

{If yesterday was day of rollover entry into this contract on close 
(Value2 = -2),then set Value2 to 2 (positive value) to enable other 
trading signals to operate}

if value2 = -2 then value2 = 2;

{Initialize condition1 to false}

condition1 = false;

{Set condition1 to true on month of rollover entry into contract}

If (month(date of today) = oldcm - 1 or 
    (month(date of today) = 12 and oldcm = 1)) and
    (year(date of today) = deliveryyear  or
    (year(date of today) = deliveryyear -1 and
    month(date of today) > deliverymonth - 2)) then condition1 = true;

{Set Value2 = -2 on day of rollover when rollover is to be 
on 25th of month or last trading day before 25th; this is for months 
where no holidays fall on 25th}

if condition1 = true and  month(date of today) <> 5 
    and  month(date of today) < 11 and rollday = 25 then begin
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) < 6 then Value2 = -2;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = -2;
end;

{Account for case in which Memorial Day may be May 25}

if condition1 = true and  month(date of today) = 5 
    and rollday = 25 then begin
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) < 6 then Value2 = -2;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 22 
        and dayofweek(date of today) = 5 then Value2 = -2;
end;

{Account for case in which Thanksgiving may be November 25}

if condition1 = true and  month(date of today) = 11 
    and rollday = 25 then begin
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) < 4 then Value2 = -2;
        if dayofmonth(date of today) = 25 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 3 then Value2 = -2;
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = -2;
end;

{Account for fact that December 25 is not a trading day}

if condition1 = true and  month(date of today) = 12 
    and rollday = 25 then begin
        if dayofmonth(date of today) = 24 
        and dayofweek(date of today) < 6 then Value2 = -2;
        if dayofmonth(date of today) = 23 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 22 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = 21 
        and dayofweek(date of today) = 5 then Value2 = -2;
end;

{Allow user to set manually a rollover date other than the 25th of
the month} 

if condition1 = true and rollday <> 25 then begin
        if dayofmonth(date of today) = rollday  
        and dayofweek(date of today) < 6 then Value2 = -2;
        if dayofmonth(date of today) = rollday - 1 
        and dayofweek(date of today) = 5 then Value2 = -2;
        if dayofmonth(date of today) = rollday - 2 
        and dayofweek(date of today) = 5 then Value2 = -2;
end;

{Rollover entry on close today if Value2 = -2, 
long if OldExPos = 1 and short if OldExPos = -1}

if Value2 = -2 and OldExPos > 0 then buy today close;
if Value2 = -2 and OldExPos < 0 then sell today close;
    
{This is the end of the block of lines containing the signal to start trading
in the current contract on the specified rollover date from the previous 
contract, and to prevent spurious trades in the current contract before
the date you rolled over into this contract.}


{The following series of lines incorporates a whipsaw filter}

If whip > 0 then value13 = stddev(close, whip);

if condition99 = false then begin
    value11 = 2./(21);
    value12 = 1. - value11;
    value99 = value13;
end;

if whip > 0 then begin
    value99 = (value99*value12) + (value13*value11);
    value1 = value13 - value99;
end;

if whip = 0 then value1 = 999;
condition99 = true;

{This is the end of the block of lines containing the whipsaw filter}


{The fundamental entry signal of this model is to enter long on the 
open today if the close of the day before yesterday was the lowest
close in the previous "Strend" number of days AND the contract
value on the close of the day before yesterday was at least 
"ValuRise" dollars higher than the contract value at the lowest
close occuring during the previous "Ltrend" (Ltrend > Strend)
number of days. The following line does this after checking to 
see that today's date is later than the rollover date.  This is to 
prevent spurious signals from being generated in a contract 
before one actually enters that contract on rollover.}


If Value1 > 0 and Value2 > 0
    and close[1] < lowest(close, Strend)[2] and 
    close[1] - lowest(close, Ltrend)[2] > ValuRise/(pointvalue*100)
    then buy open; 

{The next line is the short entry counterpart to the long entry line
above.  We enter short on the open today if (1) the close of 
the day before yesterday was the highest close in the 
previous "Strend" number of days and (2) the contract
value on the close of the day before yesterday was at least 
"ValuRise" dollars lower than the contract value at the highest
close occuring during the previous "Ltrend" (Ltrend > Strend)
number of days and (3) today's date is later than any 
rollover dates.}

If Value1 > 0 and Value2 > 0
    and close[1] > highest(close, Strend)[2] and 
    highest(close, Ltrend)[2] - close[1] > ValuRise/(pointvalue*100)
    then sell open;


{The following lines exit a position if the equity drops more 
than "MaxLDD" (for a long trade) or "MaxSDD" (for a short
trade) dollars from the highest equity position seen during
the trade.  The factor of 100 adjusts for the point value of the 
S&P Index futures contract.}

value21 = (maxpositionprofit - MaxLDD)/(pointvalue*100);
value22 = (maxpositionprofit - MaxSDD)/(pointvalue*100);
If marketposition = 1 then exitlong entryprice + value21 stop;
If marketposition = -1 then exitshort entryprice - value22 stop;

{The following lines enable one to set a "maxloss" equity change
narrower than the "MaxDD" equity change used above.
If, in a trade, the trade equity drops more than "maxloss" 
dollars below zero, the following lines exit 
the trade.  This has no effect on a profitable trade but limits the
maximum loss which a single trade can risk.  The factor of 100 
adjusts for the point value of the S&P Index futures contract.}

value23 = maxloss/(pointvalue*100);
If marketposition = 1 then exitlong entryprice - value23 stop;
If marketposition = -1 then exitshort entryprice + value23 stop;

{This is the end of the block of lines containing the fundamental
entry and exit/stop signals, the lines which have nothing to do
with the rollover function}


{The following block of lines prints instructions for switching 
contracts on day of rollover}

if value2 = 1 then begin
    print ("   ");
    print (month(date of today):2:0, "/", dayofmonth(date of today):2:0, "/", year(date of today):2:0, " IS ROLLOVER DAY");
    print ("   ");
    print ("Use Chart - Setup function to delete current and add next contract");
    print ("***AFTER*** market close on ", month(date of today):2:0, "/", dayofmonth(date of today):2:0, "/", year(date of today):2:0,);
    print ("   ");
    print ("In Analysis - System - Inputs set OldCM = ", deliverymonth:2:0);
    print ("   ");
    If marketposition = -1 then begin
        print ("In Analysis - System - Inputs set OldExPos = -1");
    end;
    If marketposition = 0 then begin
        print ("In Analysis - System - Inputs set OldExPos = 0");
    end;
    If marketposition = 1 then begin
        print ("In Analysis - System - Inputs set OldExPos = 1");
    end;
    print ("   ");
    print ("OldExPos above will change to 0 if stop is hit on ", month(date of today):2:0, "/", dayofmonth(date of today):2:0, "/", year(date of today):2:0,);
    print ("   ");
end;

{This is the end of the block of lines which prints instructions for 
switching contracts on day of rollover}



-
R-Breaker signal



{R-Breaker}
{***********SystemSetup*******************
Trading between 9:15 and 14:29 ChicagoTime only
MMStop $1000
Close End of Day
10 min Time Frame
******************************************}


input:notbef(715),notaft(1229);
var:{input:}f1(.35),f2(0.07),f3(.25),reverse(2.00),
  rangemin(1.15),xdiv(3);

var:ssetup(0),bsetup(0),senter(0),benter(0),bbreak(0),sbreak(0),
  ltoday(0),hitoday(9999),startnow(0),div(0),
  rfilter(false);


if currentbar=1 then startnow=0;
div=maxlist(xdiv,1);
if d>d[1] then begin

  startnow=startnow+1;

  ssetup=hitoday[1]+f1*(c[1]-ltoday[1]);
  senter=((1+f2)/2)*(hitoday[1]+c[1])-(f2)*ltoday[1];
  benter=((1+f2)/2)*(ltoday[1]+c[1])-(f2)*hitoday[1];
  bsetup=ltoday[1]-f1*(hitoday[1]-c[1]);
  bbreak=ssetup+f3*(ssetup-bsetup){(1.3625*hitoday[1]+.45*c[1])-.8125*ltoday[1]};
  sbreak=bsetup-f3*(ssetup-bsetup){(1.3625*ltoday[1]+.45*c[1])-.8125*hitoday[1]};

  hitoday=h;
  ltoday=l;

  rfilter=hitoday[1]-ltoday[1]>=rangemin;

end;

if h>hitoday then hitoday=h;
if l<ltoday then ltoday=l;

if t>=notbef and t<notaft and startnow>=2 and rfilter and
date>entrydate(1) then begin

  if hitoday>=ssetup and marketposition>-1 then
    SELL("Rlev SE") senter+(hitoday-ssetup)/div stop;
  if ltoday<=bsetup and marketposition<1 then
    BUY("Rlev LE") benter-(bsetup-ltoday)/div stop;

  if marketposition=-1 then
    BUY("RbUP LE") entryprice+reverse stop;
  if marketposition=1 then
    SELL("RbDN SE") entryprice-reverse stop;

  if marketposition=0 then
    BUY("Break LE") bbreak stop;
  if marketposition=0 then
    SELL("Break SE") sbreak stop;

end;

if t>=notaft and t<>sess1endtime then begin

  if marketposition=-1 then
    EXITSHORT("RbUP SX") entryprice+reverse stop;
  if marketposition=1 then
    EXITLONG("RbDN LX") entryprice-reverse stop;

  EXITSHORT("Late SX") h+.05 stop;
  EXITLONG("Late LX") l-.05 stop;
END;


{END ELSE BEGIN IF T=SESS1FIRSTBARTIME
OR T[1]=SESS1FIRSTBARTIME THEN
IF (INTPORTION(CURRENTBAR/2))*2=CURRENTBAR THEN
BUY("EXPIRED") C ELSE SELL("EXPIRED ") C;END;}




-
R-level signal


input:pset1to5(3),notbef(715),notaft(1229);

vars:reverse(2.00),rangemin(1.15),xdiv(3),f1(0.5),f2(.11),
  ps(0);
ps=intportion(pset1to5);
if ps>5 or ps<1 then ps=3;
if ps=1 then begin
  reverse=2.00;rangemin=1.15;xdiv=3;f1=0.55;f2=.13;
end;
if ps=2 then begin
  reverse=2.00;rangemin=1.15;xdiv=3;f1=0.5;f2=.115;
end;
if ps=3 then begin
  reverse=2.00;rangemin=1.15;xdiv=3;f1=0.45;f2=.1;
end;
if ps=4 then begin
  reverse=2.00;rangemin=1.15;xdiv=3;f1=0.4;f2=.085;
end;
if ps=5 then begin
  reverse=2.00;rangemin=1.15;xdiv=3;f1=0.35;f2=.07;
end;

vars:ssetup(0),bsetup(0),senter(0),benter(0),
  ltoday(0),hitoday(9999),startnow(0),div(0),
  rfilter(false);

if currentbar=1 then startnow=0;
div=maxlist(xdiv,1);
if d>d[1] then begin

  startnow=startnow+1;

  ssetup=hitoday[1]+f1*(c[1]-ltoday[1]);
  senter=((1+f2)/2)*(hitoday[1]+c[1])-(f2)*ltoday[1];
  benter=((1+f2)/2)*(ltoday[1]+c[1])-(f2)*hitoday[1];
  bsetup=ltoday[1]-f1*(hitoday[1]-c[1]);


  hitoday=h;
  ltoday=l;

  rfilter=hitoday[1]-ltoday[1]>=rangemin;

end;

if h>hitoday then hitoday=h;
if l<ltoday then ltoday=l;

if t>=notbef and t<notaft and startnow>=2 and rfilter and
date>entrydate(1) then begin

  if hitoday>=ssetup and marketposition>-1 then
    SELL("Rlev SE") senter+(hitoday-ssetup)/div stop;
  if ltoday<=bsetup and marketposition<1 then
    BUY("Rlev LE") benter-(bsetup-ltoday)/div stop;

  if marketposition=-1 then
    BUY("RbUP LE") entryprice+reverse stop;
  if marketposition=1 then
    SELL("RbDN SE") entryprice-reverse stop;

end;

if t>=notaft then begin
  if marketposition=-1 then
    EXITSHORT("RbUP SX") entryprice+reverse stop;
  if marketposition=1 then
    EXITLONG("RbDN LX") entryprice-reverse stop;
end;

'선물옵션 > 선물옵션 일반' 카테고리의 다른 글

시스템트레이딩 고수되기  (0) 2022.09.11
해외선물시장의 이해  (0) 2022.09.11
LME (LONDON METAL EXCHANGE) 소개서  (0) 2022.09.11
선물/옵션투자전략핸드북  (0) 2022.09.10
삼산이수 짤막팁  (0) 2022.09.10

댓글