STOP BELOW SIGNAL CANDLE
Forums › ProRealTime English forum › ProOrder support › STOP BELOW SIGNAL CANDLE
- This topic has 8 replies, 6 voices, and was last updated 5 years ago by Valentin.
Tagged: stop signal
-
-
05/23/2017 at 12:39 PM #36402
Hi,
I’m having trouble getting my stop to be placed below the signal candle. Please can you tell me where i’m going wrong.
12345678910111213141516171819DEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsc1 = (close > open)indicator1 = Average[20](close)c2 = (close > indicator1)indicator2 = Average[20](close)c3 = (low < indicator2)IF c1 AND c2 AND c3 THENBUY 1 CONTRACT AT MARKETENDIFslong = TRADEPRICE - low[0]SET STOP LOSS slongSET TARGET pPROFIT 10005/26/2017 at 7:07 PM #36725If you put figures in you will see it? The heat today has switched my brain off, I will probably think what it should be when it gets cooler? 🙂
slong = 10000 – 9800SET STOP LOSS 200Maybe …
12slong = TRADEPRICE - (TRADEPRICE - low[0])SET STOP LOSS slong05/29/2017 at 7:27 AM #36858Tradeprice is an absolute price / the price that the position was opened at. Thus you can’t reference LOW because LOW relates to a candle and not Tradeprice – I think. What you have to do is reference the LOW of the bar when it was opened. What i think your looking for is Tradeindex.
05/29/2017 at 8:57 AM #36863Forget my previous at #36725 (the heat really did addle my brain! :)).
You need to record / use the low at the time of the Trade so the definition of slong at time of Buy needs to be bounded by the If Endif statement as below.
Try it anyway and let us know please?
123456IF c1 AND c2 AND c3 THENBUY 1 CONTRACT AT MARKETslong = TradePrice - LowENDIFSET STOP pLOSS slong1 user thanked author for this post.
09/15/2018 at 11:16 AM #80559Hello community,
I am looking for approximately the same request than Kage12 but instead of using the low of the signal candlestick as a stop, I would like to use the low of the day before the signal.
I tried to edit the code that Grahal sent but my version doesn’t seem to work as some orders are closed without touching the low of the day before the signal (please find attached a screenshot).
Stop Below Low of the Day before the Signal123456IF c1 THENBUY 1 CONTRACT AT MARKETslong = TradePrice - Low[1]ENDIFSET STOP pLOSS slongPlease note that below the last line of my code, i’ve got some conditions to close my positions. The stop loss i’m asking would be used as a protective stop and to optimize my money management.
Also, i’v tried the original version that Grahal sent and the orders are closed the same day of the signal so if you also have a solution to fix that, l would be very interested to run some backtest.
Thank you in advance and have a great day !
Valentin
09/15/2018 at 11:29 AM #80562GraHal is right about IF..ENDIF.
But you should replace line 3 with
1slong = close - Lowbecause
- TRADEPRICE will be known the next bar
- when you BUY/SELLSHORT at market the price will be the current one, that is CLOSE (+- some gap and/or slippage).
09/15/2018 at 11:30 AM #8056309/17/2018 at 8:00 AM #8066209/23/2018 at 6:26 PM #81130 -
AuthorPosts
Find exclusive trading pro-tools on