Seer logo - advanced backtesting for stock, futures and forex trading systems using using technical analysis indicators, charts, money management and position sizing
SID NameDescriptionRatingUpdated
337 OrderHedgeSimple Order Hedge We want to create two orders, one above the market (which will go long) and one below the market (which will go short) If either order is filled, we cancel the other. If none of the orders are filled for this bar, we keep both active Not Approved2007-10-23

Notes for this Trading Account:

Simple Order Hedge

We want to create two orders, one above the market (which will go long) and one below the market (which will go short)

If either order is filled, we cancel the other. If none of the orders are filled for this bar, we keep both active until one is filled.

As the option "Implicit Once Cancels All (OCA) group for each system" has been checked in the system object, Seer will cancel the orders for us.

Rules for this Trading Account:

Notes for this Trading System:

Rules for this Trading System:

Bar event logic:

#We want to create two orders, one above the market (go long) and 
#one below (go short)

#If either order is filled, we cancel the other. If none of the orders
#are filled for this bar, we keep both active until one is filled.

#As the option "Implicit Once Cancels All (OCA) group for each system"
#has been checked in the system object, Seer will cancel the orders
#for us.

unless (Position or Orders) {
  #we dont have a position or any active orders for this symbol
  
  #we define the spead price as 1/2 of a 45 bar average true range
  my $orderspread=Now(ATR(45))/2;
  PlaceBuyStop('Above Market',100,ClosePrice+$orderspread);
  PlaceSellStop('Below Market',100,ClosePrice-$orderspread);
}

#Exit logic - close close after 6 bars

if (Position and BarsSinceEntry==6) {
  if (LongPosition) {
    #If we have a long position, close it.
    PlaceSellOpen('Exit');
  }
  else {
    PlaceBuyOpen('Exit');
  }
}

© 2008 seer trading systems ltd
feedback FAQ legal privacy