Hi,
My strategy below is opening correctly but not setting a stop – I am just wondering if anyone could tell me why the stop is blank when it opens. It seems to work on back testing:
c1 = (low < indicator1)
c2 = close > midPrev
c3 = (BBwidth > 50)
c4 = (open[1] > close[1]) and rangeprevious > 3
c5 = (indicator2 > 33)
c6 = ( (Average[20](close) - 2 * Std[20](close)) - low ) > 8
c7 = (Close - open) > 20
c8 = (Close - open) < 30
IF (c1 and c2 AND c3 and c4 and c5 and c6 and c7 and c8) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
buy 5 PERPOINT AT MARKET
entryLow = low // Store the low of the candle before the entry candle
endif
// Exit condition
if onmarket then
// Exit at the low of the candle before the entry candle
sell at entrylow stop
SET TARGET PROFIT 45
Hi,
The missing ENDIF you showed would actually throw a compilation error, so I assume your real code has it and was just cut off when pasting here.
Without seeing your full code (including how indicator1, indicator2, midPrev, BBwidth, rangeprevious and the time/day filters are defined) we can’t reproduce the issue.
I’ve tested a simplified version replicating your exact structure with standard indicators, and the stop works correctly in backtesting.
Could you please share the complete code? That way we can properly investigate why the stop appears blank in live execution.
In the meantime, you can add this line to your backtest version to visually confirm the stop level:
GRAPHONPRICE entryLow
This will draw the stop level on the chart. Remove it before running live.
On what timeframe do you launch the strategy on please?
If the Low is too close of the order opening price, the broker might reject it due to minimum stop distance.
However, try to use this way of setting the stop at a direct price, with SET STOP PRICE:
c1 = (low < indicator1)
c2 = close > midPrev
c3 = (BBwidth > 50)
c4 = (open[1] > close[1]) and rangeprevious > 3
c5 = (indicator2 > 33)
c6 = ( (Average[20](close) - 2 * Std[20](close)) - low ) > 8
c7 = (Close - open) > 20
c8 = (Close - open) < 30
IF (c1 and c2 AND c3 and c4 and c5 and c6 and c7 and c8) AND timeEnterBefore AND timeEnterAfter AND not daysForbiddenEntry THEN
buy 5 PERPOINT AT MARKET
entryLow = low // Store the low of the candle before the entry candle
SET STOP PRICE entryLow
SET TARGET PROFIT 45
endif