variables:
Avg1( 0 ),
Avg2( 0 ),
MP (0), //MarketPosition Reservered word
StartUnemploymentRate1 ( 0829),
EndUnemploymentRate1 ( 0830),
StartCrudeOilInvetories1 ( 1029),
EndCrudeOilInvetories1 ( 1031),
StartCrudeOilInvetories2 ( 1100),
EndCrudeOilInvetories2 ( 1101),
StartNaturalGasInventories1 ( 1029),
EndNaturalGasInventories1 ( 1031),
StartCropProduction1 ( 1159),
EndCropProduction1 ( 1201),
StartFOMCStatement1 ( 1259),
EndFOMCStatement2 ( 1259),
StartofDay ( 0931),
EndofDay ( 1500);
//Economic Announcements that we do not want to trade in:
Condition1 = T >= StartUnemploymentRate1 and T <= EndUnemploymentRate1;
Condition2 = T >= StartCrudeOilInvetories1 and T <= EndCrudeOilInvetories1;
Condition3 = T >= StartCrudeOilInvetories2 and T <= EndCrudeOilInvetories2;
Condition4 = T >= StartNaturalGasInventories1 and T <= EndNaturalGasInventories1;
Condition5 = T >= StartCropProduction1 and T <= EndCropProduction1;
Condition6 = T >= StartFOMCStatement1 and T <= EndFOMCStatement2;
Condition7 = T >= StartofDay and T <= EndofDay;
//Need to define strategy to not trade during these predetermined timeframes
// This ensures me all trades are closed before the respective time
if MarketPosition <> 0 and Condition1 = True then begin
if MarketPosition = 1 then Sell All
Contracts Next Bar At Market;
if MarketPosition = -1 then Buytocover All Contracts Next Bar At Market;
end;