VTrend2_Mar2014

Default image
VTrend2_Mar2014 is swing trading strategy, which performs best on trending pairs with long (500+ pips) swings. Input parameters defaultInstrument: EUR/NZD - instrument used defaultTradeAmount: 2.0 - starting amount used in position size calculation defaultSlippage: 5 - maximum allowed slippage in pips defaultStopLoss: 333 - stop loss in pips defaultTakeProfit: 977 - take profit in pips defaultPeriod: 1 Min - period maxSpread: 4.0 - maximum allowed spread in pips maTimePeriod: 2 - time period of exponential moving average (ema) maPeriod: H4 - period of exponential moving average (ema) scaleInRatio: 1.05 - used in position size calculation formula scaleInPips: 10.0 - number of pips after which to recalculate position size (scale in) scaleOutRatio: 0.98 - used in position size calculation formula scaleOutPips: 10.0 - number of pips after which to recalculate position size (scale out) maxAmount: 3.0 - maximum amount used in position size calculation closePosition: false - close open position Trading logic 1. Starts execution in onCandle event handler. Continues only if candle instrument equals defaultInstrument and candle period equals defaultPeriod. 2. Calculates spread and compares it to maxSpread. Continues only if spread is lower than maxSpread. This filters out unfavorable trading conditions. 3. Checks number of positions. 3.a If there are no positions it calculates two values from ema (with period maPeriod, time period maTimePeriod, based on closing prices). First is for two periods back, second for one period back. It resets tradeNum to zero, scalingIn to true and amount to defaultTradeAmount. It compares first ema value with the second and opens short position if the first is greater than the second or long position otherwise. Position is opened using: - defaultInstrument - amount - defaultSlippage - defaultStopLoss - defaultTakeProfit It increases tradeNum by 1. 3.b If there are positions, it checks if there are open (filled) positions. If there are no open positions it returns. If closePosition is true, it closes open position, resets closePosition to false and returns. It checks position profit. If position profit is greater than scaleInPips (when scalingIn is true) or scaleOutPips (when scalingIn is false), it continues execution. It saves position stop loss and take profit prices to sl and tp variables. If amount is greater thean maxAmount it sets scalingIn to false. It calculates position size with the following formulas: amount * scaleInRatio (when scalingIn is true) or amount * scaleOutRatio (when scalingIn is false). This allows to gradually increase position size when momentum builds and also to gradually decrease position size, while running towards the target and possibility of reversal rises. It updates (tightens) sl by as much as position moved into profit. It closes position and then reopens it, using: - defaultInstrument - amount (updated) - defaultSlippage - sl (updated) - tp (same as initial) It increases tradeNum by 1.
Version: Date: Status: Description:
1 02.03.2014 Not running VTrend2_Mar2014  Download
orto leave comments


(few words about added changes)

(example: 1.1, beta, alpha)