PureBytes Links
Trading Reference Links
|
Hello,
I am trying to add this signal to a system to simulate
closing out a position in continous contracts on the
3rd Friday of the trading months and then getting back
into a position in the same direction. I have two
problems:
1. This code exits and enters but always does it
twice instead of just exiting and then reentering.
2. I want to exit and enter Market On Close and cannot
figure out how to do this.
Thanks in advance,
Mike Kittelson
var:CloseOut(false),LastNotice(0);
If ((Month(Date)=3) or (Month(Date)=6) or
(Month(Date)=9) or (Month(Date)=12))
then CloseOut=true else closeout=false;
If Closeout=false then LastNotice=0;
If CloseOut and DayofWeek(Date)=4 then LastNotice=
LastNotice + 1;
If MarketPosition=1 and LastNotice=3 and
DayOfWeek(date)=4
then exitlong("lx.rollover") 1 contract tomorrow at
open;
If MarketPosition=1 and LastNotice=3 and
DayofWeek(date)=4
then buy("le.rollover") 1 contract tomorrow at open;
If MarketPosition=-1 and LastNotice=3 and
DayOfWeek(date)=4
then exitshort("sx.rollover") 1 contract tomorrow at
open;
If MarketPosition=-1 and LastNotice=3 and
DayofWeek(date)=4
then sell("se.rollover") 1 contract tomorrow at open;
=====
Regards,
Mike Kittelson
|