Hi everyone. I am very new at this, I tried and failed to set it up so I’m left with having to ask for help.
On the close of the signal candle I’d like to place a limit order based on a stop loss level.
For example, for a long, once the signal candle closes, I’d want my stop lets say 5 points beneath the low and would want to risk lets say 10 points. I’d get in if the market pulls back to the level or, limit order to turn to market order if price already lower. The option of a target would be a bonus.
Alternatively consider the range of the signal candle and then place a limit order on a percentage retracement.
Does anyone have the code for something like this?
Thank you in advance,
Catalin
You wrote “I’d want my stop lets say 5 points beneath the low and would want to risk lets say 10 points“. What if the distance from the current price and the low-5 points is higher than 10 points? Would you reduce the SL or ignore the signal without opening a trade?
Anyway, to set a stop loss 5 points beneath the low of the signal candle:
IF MyLongConditions THEN
BUY 1 Contract at Market
SET STOP PRICE low - 5*PipSize
ENDIF
I’m not sure, but when he said : “I’d want my stop lets say 5 points beneath the low and would want to risk lets say 10 points“, maybe he want to risk 2 lots : 2 x 5 pips = 10
Thank you gents,
ZeroCafeine, I spread bet and I am ok with setting the bet size.
Roberto, is there a way to set a limit order? I attached a file hopefully making it clearer.
Thanks,
Catalin
There you go (not tested):
IF OnMarket THEN
SL = 0
ENDIF
IF MyLongConditions THEN
SL = low - 5*PipSize
Entry = min(open,close) - 5*PipSize
SET STOP PRICE SL
ENDIF
IF SL <> 0 THEN
BUY 1 Contract at Entry LIMIT
ENDIF
Thanks for your time but I can’t get it to work, most probably because I’m illiterate.
Will keep trying 🙂
Append these two lines to your code, to plot both SL and ENTRY on your chart when backtesting:
GraphOnPrice ENTRY coloured("Blue",255)
GraphOnPrice SL coloured("Red",255)