Unwanted Multiple Orders with Stop Order
Forums › ProRealTime English forum › ProOrder support › Unwanted Multiple Orders with Stop Order
- This topic has 2 replies, 1 voice, and was last updated 3 years ago by jpgcreatestrading.
-
-
04/16/2021 at 3:05 PM #167270
Hi, this is the first time i have ever posted on the website, so apologies if i don’t follow the correct protocols, or have posted in the wrong place.
I am struggling with the backtesting software and a strategy i have been working on. My aim is to use Stop Orders to enter the market, with CumulateOrders True as often more than one trade will be open at once. the problem i run into is that it will send multiple Orders to the market with a single trigger; i.e. when my signal triggers i place a Stop Order to buy at a certain price above the current close, and this will cause multiple orders at market.
to give more details, the set up is as follows:
wait until price is above 21 SMA – set direction to 1
wait for a single candle pullback, use this as a signal bar, place a buy level 2pts above, and sell level below
when a signal bar occurs (the single candle pullback) i set up the system with “Buysystem”; this is so that if the price goes below the sell height before activating the trade, it will cancel the setup and never take the trade off that bar, and look for a new setup.
if the trade is activated, the “Buysystem” will turn off as well.
the trouble is, even though the “Buysystem” reverts to zero, another order to market is often placed, if the price carries up in the direction, as far as i am aware this should not happen as it should only buy when the “Buysystem” is on…?
i have noticed this problem with a few of my systems, and my main one is way to long (and probably poorly written) to include here, so i have written a simple one to get to the bottom of this problem. i have also noticed the same thing happens when i want to exit the position (when countofposition is more than 1 obviously). in general, i am only wanting to buy once per trigger (or exit once per exit trigger), not twice as is often happening.
one quick fix i found is:
1if not (COUNTOFshortSHARES[0] < COUNTOFshortSHARES[1]) then, or
1if COUNTOFshortSHARES[0] = COUNTOFshortSHARES[1])thenthese will work, however if there are two consecutive signals, then it means the second order wont go through until the bar after that (leaving a bar between), which is bad for exiting the trade as the trade will possible continue unwanted.
i have commented out the sellshort orders to solve one issue at a time.
i have attached photos below of what i am relating to. i have circled with a dotted red circle to show the double orders, i have also held the mouce over one of the orders so that it shows the “BuySystem” zeros out when the first order is place and so the second order should not occur.
sorry if i have described the situation poorly…
BuySystem123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566defparam flatafter = 160000timok = time > 080000 AND time < 160000sma = average[21](close)if close > sma thendirection = 1elsif close < sma thendirection = -1elsedirection = 0endifif direction = 1 thenif NOT Buysystem thenif high[1] = highest[3](high) AND high[1] <> high[2] thenbuyheight = high[1] + 2sellheight = (Min(Min(Low[0], Low[1]) - 2, Close - 4))Buysystem = 1endifendifendifif Buysystem AND timok thenif low <= sellheight thenBuysystem = 0endifBUY 1 SHARES AT buyheight stopif high >= buyheight - 0.5 then // minus spreadBuysystem = 0endifendif//if direction = -1 then//if NOT sellshortsystem then//if low[1] = lowest[3](low) AND low[1] <> low[2] then//sellshortheight = high[1] + 2//exitshortheight = Max(Max(High[0], High[1]) + 2, Close + 4)//sellshortsystem = 1//endif//endif//endif//if sellshortsystem AND timok then//if low <= exitshortheight then//sellshortsystem = 0//endif//BUY 1 SHARES AT sellshortheight stop//if high >= sellshortheight then//sellshortsystem = 0//endif//endifif Not timok thenBuysystem = 0sellshortsystem = 0endifif onmarket thenset target profit 10set stop loss 10endifgraphonprice smagraphonprice buyheight coloured(0,0,150)graphonprice sellheight coloured(150,0,0)graph Buysystem04/16/2021 at 3:06 PM #167273sorry the following photo did not attach to the original post
04/16/2021 at 4:05 PM #167279i think this is also part of the problem (maybe will help with the solution)
i have attached a photo of another strategy in progress with a trailing stop based on my ADX type indicator. i have graphed the Stop Loss with a black line. as you can see, the stop loss trails nicely and price should have been Stopped out at 08:32 (first red circle), but the trade wasn’t Stopped out until later (the second red circle).
it seems that there is a delay in recognising signals. all the calculations are there and are correct to the bar (to the minute), but the Orders don’t realise until a bar later.
so as you can see the trailing Stop does work (i can also post more photos of this strategy to show it works elsewhere if necessary), but it doesn’t seem to take action if the Stop Loss was trailed on the bar previous
-
AuthorPosts
Find exclusive trading pro-tools on