Hello, I’m testing a simple backtest, below is an outline of what it should do
- Adjust the level at which a Short is triggered if a higher low for the previous candle occurs.
- The level of the Short is set to the value of the new higher low minus 10pips
For some reason it never triggers, if I set an explicit vale like, 1.48020 then it’ll work fine, attached is a screenshot of my backtest with indicators as to where it starts and where I expect the trigger to occur. Any help or suggestions would be greatly appreciated.
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
ONCE levelUpdated = 0
ONCE trackPips = 0.00100
ONCE shortPrice = 0
IF (Low[1]-trackPips) > shortPrice THEN
shortPrice = (Low[1]-trackPips)
levelUpdated = 1
ENDIF
IF STRATEGYPROFIT > 0 OR STRATEGYPROFIT < 0 THEN
QUIT
ENDIF
IF levelUpdated = 1 THEN
SELLSHORT 1 CONTRACT AT shortPrice STOP
levelUpdated = 0
ENDIF
I reckon the problem is to do with the trackPips, but I can’t explain why (without thinking how to explain, maybe more later)! 🙂
Also your code doesn’t mention highest low (or can’t I see it?) but your image states that Sellshort should have executed at 10 points below highest low?
GRAPH ShortPrice
while backtesting will surely gives you useful info to spot where the trouble is!