I am currently implementing a strategy that tries to detect short-term, intraday trends and ride them for a while until a profit target or a stop loss is hit. 

The strategy should detect intraday momentum based on a few common indicators:

if self.eurUsd.macd.Current.Value>0 \
and self.eurUsd.macd.Current.Value > self.eurUsd.macd.Signal.Current.Value \
and self.eurUsd.bb.UpperBand.Current.Value>self.eurUsd.bbUpperPrevious \
and self.eurUsd.rsi.Current.Value>0.7:
self.Debug("Place Order!")

If the conditions are true, an order should be placed in the following way:

stopLoss = self.eurUsd.atr.Current.Value * 0.1
profitTarget = self.eurUsd.atr.Current.Value * 0.15
currentPrice = data[self.eurUsd.symbol].Price
stopLossPrice = currentPrice - stopLoss
profitTargetPrice = currentPrice + profitTarget
limitPrice = self.eurUsd.bb.UpperBand.Current.Value
#Place an order with the following features:
# - enter 100% long position once price of currency pair is above limitPrice
# - close long position once the price of the currency pair is
# below stopLossPrice or above profitTargetPrice

The strategy is still in an early development stage and obviously, all comments are highly appreciated. 

Currently I am stuck at implementing an order placement with the following conditions:

  • Open 100% long position, once the price of the currency pair is above the limitPrice
  • Close the long position, once the price of the currency pair is above the profitTargetPrice or below the stopLossPrice

See the attached code for all details. 

Author