Now let’s take a deeper look at how a trade works with this trading system. First of all, the precondition must be valid to allow the trade. This is stored in the variable called TradingPermission in the AFL code that I published earlier. The precondition must be valid within a daily time frame. The Body of the day before must be small compared to its TrueRange. The Shadow of the candle also works well, but I prefer to use TrueRange. Very often TrueRange is equal to the Shadow. I code this assumption in this way:
TradingPermission = abs( Close – Open ) < Doji * TrueRange;
Doji is a parameter whose value is 0.4, so Body is 40% smaller than TrueRange.
To get an image of what I am writing about here are two examples where the precondition occurs.
In the first example TrueRange differs from the Shadow because the Close price is outside the Shadow, in both examples the precondition is met.
Now let’s take a look at how a trade takes place and develops. In the image above you can see a blue line at the opening price of the day and two opposing white bands around it. These are the thresholds that trigger the trade when the price crosses above or below, but only if this happens in the predefined time interval. Thresholds are stored in these two variables:
PriceThresholdUp = RoundToNearestTick(Ref( Open, 1 ) + Threshold * TrueRange);
PriceThresholdDn = RoundToNearestTick(Ref( Open, 1 ) – Threshold * TrueRange);
You can see that the thresholds are opposite to the opening price and are displaced by a fraction of the TrueRange. The Threshold values are 0.4.
The time must be inside the interval 9.20 – 17.00.
The price crosses the PriceThresholdUp at about the 10.30 an the system enters the market with a long position. The trade develops very well until it closes at the exit time which is at 17.30. Notice how the PriceThresholdUp works well as a resistance about 15.00. The red line is the equity line that changes its value during the trade is happening.
But now we look at a losing short trade.
Here the trade is not triggered by the crossing of the price below the PriceThresholdDn, that is because the crossing occurs before the time interval (9.20 – 17.00), therefore when the time is inside the interval and the price is still at below the threshold, the system enters the market with a short position. But things go wrong this time and at 15.00 the stop order is activated and the position is closed with a fixed loss amount of 200 points, which are 1000 €.
But the day is not over yet and there is the possibility that a long trade will be fired and this happens at about 16:00, this time the trade is profitable and is closed at the time of exit as in the first example above. See the next picture.
That is all, in the next post I will talk about the actual performance of the trading system.