Sell at market instead of hitting guaranteed stop
Forums › ProRealTime English forum › ProOrder support › Sell at market instead of hitting guaranteed stop
- This topic has 61 replies, 6 voices, and was last updated 3 years ago by
PeterSt.
-
-
02/07/2022 at 6:45 AM #187714
Mike, I feel it can be this one :
1Set target profit tpThis is a bit of a long shot, but what if your TP is just set too low and the price dropped under it (and up again).
Otherwise, try to show some of your crucial variables with Graph, like
12Graph TPGraph SL Coloured (255,0,0)In order to show the graphs, use a dummy Optimisation variable like you see below.
02/07/2022 at 10:07 AM #187741The tp is absolutely fine. I’m talking about losing trades here.
I’ve attached one screengrab which shows the entry bar, and also shows the graphed result of slpricelong at 7,636 (which is correct).
The other screengrab shows the bar at 13:45, which goes low enough to trigger an exit, but the trade doesn’t exit. The exact same trade closes on this bar when I use the “set stop loss” command.
Despite there being many more bars where the price is lower than the intended exit point, the trade goes on for 10 days and eventually closes when it hits the tp mark.
Also, every short trade in the backtest results closes within one bar (even though slpriceshort is set correctly).
Any ideas anyone?
02/07/2022 at 10:21 AM #187750The tp is absolutely fine. I’m talking about losing trades here.
Sure. But I was referring to the TP being too low hence under the entry price for Long or above it for Short. But I suppose you have checked that now.
Maybe it was shown somewhere already, but on what instrument are you doing this (plus Timeframe and Period) ? then someone (or maybe me) can see what happens.
Do you have ProBacktest in Tick by Tick mode active ? that seems paramount to me in this case.
02/07/2022 at 10:40 AM #187753Yes, it’s in tick-by-tick mode. It’s the AUD USD 75 minute chart (I know that’s an irregular time period but that definitely isn’t the problem – I’ve tried this code on an hourly chart)
02/07/2022 at 12:41 PM #187765Mike, here you are :
123456789101112if not onmarket and crossflag=-1 and shortentry and mac4flag=-1 and upperflag=-1 then //and time >=StartTime and time <LimitEntrytime and not exclude thensl=AverageTrueRange[14]*2tp=sl * 1.5Set target profit tp//slpriceshort = close + slslpriceshort = sl - close // 07-02-2022,PS, Must be like this.//Set stop loss slrisk=100/sl/10000Sellshort risk PERPOINT AT limitsell limitGraph sl coloured (255,0,0)Graph tpendifThere’s no copyright on this one, right ?
Notice the order value; I had to guess what you used for contract size. I used a Spread of 0.8.02/07/2022 at 12:59 PM #18776902/07/2022 at 1:05 PM #18777302/07/2022 at 1:52 PM #187781Peter,
This isn’t what I need. Yes, those returns look good but they are derived from trades that don’t close until they hit the profit target. Where are the losing trades that hit the stop?
My requirements are simple: I want my losing trades to close at a level that is 2* the ATR at trade entry, i.e. 30 points worse than my original entry position. I was able to make this happen when I used “set stop loss”, but I want to avoid using “set stop loss” because then I would have to pay a guaranteed stop charge every time they are hit. Instead I want to “exit” losing trades at the same level without hitting something that is a stop.
02/07/2022 at 2:37 PM #187795Mike, Mike, Mike … All I did was solving the problem with the close in the first bar.
Next, it doesn’t want to lose. What can I do about that ? make it worse somewhere ?You could try to tell me that the pending stops are never hit. I did not look into that …
02/07/2022 at 2:44 PM #18779702/07/2022 at 3:02 PM #187801those returns look good but they are derived from trades that don’t close until they hit the profit target. Where are the losing trades that hit the stop?
OK, looking into it (as far as time permits). I am intrigued.
1 user thanked author for this post.
02/07/2022 at 3:06 PM #187805Mike, Mike, Mike … All I did was solving the problem with the close in the first bar.
Next, it doesn’t want to lose. What can I do about that ? make it worse somewhere ?
You could try to tell me that the pending stops are never hit. I did not look into that …
Peter,
The system you have generated is a totally different take on trading than the rules I am using. It functions without a stop and sits in a trade until it reaches a positive position. So in one sense, yes, I want you to make it “worse”.
By changing the short exit to “slpriceshort = sl – close”, all you have done is guaranteed that every exit is in a positive position. If the “sl” happens to be 50, and the entry price happens to be 7000, you are left with a figure of 6,500 as an exit. That is a winning trade!! The market has gone lower on a short! I am not interested in changing anything about my winning trades (my take profit code does that perfectly well) – I only want a solution for the losing trades.
The key to it is this code that came from Roberto:
“if shortonmarket and close < slpriceshort then
exitshort at sl stop
endif”For some reason, this only occasionally works. Most of the time the losing bar ignores this figure, and the trade only closes once it hits the take profit for a winning position.
02/07/2022 at 3:18 PM #187810Thank you for the elaboration, Mike.For some reason, this only occasionally works.
Well, it never seems to work. But as said – looking into it.
I am now more “into it” and indeed the drawdown as how it is now is not what anyone would want.
But really, I only tried to solve that 1-bar thing. That *is* solved how it should, but the remainder just doesn’t want to work out (yet 😉 ).02/07/2022 at 3:46 PM #187813Hi @Mike,
Why not using a trailing stop (not a guaranteed stop)
SET STOP TRAILING x
@JS,
If you use “set stop TRAILING” then you can’t subsequently use “set stop loss” as your guaranteed emergency stop. But I’ve actually worked around this in the past with the help of @Vonasi on this forum. The trailing exit was created by calculating a moving figure that updated each bar, and then it would “sell at market” when those conditions were hit. I’m seeking to do the same thing with my current code, except for two things:- I don’t want the exit level to move with every bar
- I don’t want the sell to be triggered by something that is calculated on the close of every bar (because on a 75-minute chart, that is a very big time delay)
This is the code I’m trying (and failing!) to emulate. Roberto got the closest with his suggestion but that only worked occasionally.
Trailing code12345678910111213141516171819if not onmarket and entryflag=1 and highest[10] >= highest[45] and shortentry1 thenSellshort 1 perpoint at marketentryflag=0sl= AverageTrueRange[14](close) * VLSTOPslprice = close + slendifif shortonmarket and low + sl < slprice - slmove thenslprice = low + slendifif shortonmarket and close > slprice thenexitshort at marketendifSet stop ploss 1500As you can see, that code enables me to set a giant emergency guaranteed stop of 1,500 that is out of the way of my normal trades, and my losing trades are calculated with a trailing exit that doesn’t incur charges, unless there is the one in 10-year occasion where the market crashes and the sell price is forced down to my guaranteed emergency stop level.
02/08/2022 at 6:34 AM #187856I got it working, but I am not finished with it. It requires more “understanding”.
The first attachment shows a loss in the middle of a bar. All losses do this, and they do it perfectly. Sadly this is my method with the Limit.
The second attachment shows one example with the Pending Stop Loss. It is hard to find any which exits in the middle of a bar. They mainly seem to overshoot, like you see in the 3rd attachment. For this situation (overshoot) I can’t quickly reason whether this is OK or not, but where my Limit all looks “logical” the Pending Stops hardly do anywhere.One would say that I apply all correctly (otherwise I would not have gotten the Limit to work fine ?), but both work out differently for sure.
Both situations don’t perform the same, but the main line is equal (4th attachment shows the Limit).
All feels like a Stop behaving differently on the Market than a Buy/SellShort (which it is for the Limit situation). But difficult to judge (for me) because it is backtesting.
Ah … wait … I think I already mentioned it in between the lines … A Buy (/SellShort) must first drop under the price before it goes up and then buys from “under” but buys “above”. A Stop would drop *at* the price which is a little lower. Ehmm … bzzz … Which thus incurs for a bit more loss.People can also try to wrap their head around the fact that almost all Limit-exits are followed by a Buy (SellShort) again in the same bar. With the Stop this hardly happens (if you look at mentioned overshoot you can already see it won’t do that). This is the ATR logic in the Strategy doing this, which is also why the Limit feels way more natural (to me ? because I use it all the time manually anyway ?).
No room for more attachments in this post, but the Pending Stop makes 15K profit of it. So although the general line is very similar, the difference is significant (and could be coincidence – just saying).
More later.
-
AuthorPosts
Find exclusive trading pro-tools on