always execute stop/limit order at next bar
Forums › ProRealTime English forum › ProOrder support › always execute stop/limit order at next bar
- This topic has 5 replies, 3 voices, and was last updated 3 years ago by nonetheless.
-
-
01/24/2021 at 11:34 PM #159301
Hi, I’am stuck on something. It’s not intended for live, but for backtest purpose.
defparam cumulative orders=true.
I’ve a buy signal and a long position will be sold at the market next bar open.
But at the same time I need to buy at that bar where that long position was closed.
How do I write the condition with stop/limit so the order will always be executed, regardless how the next candle (after the signal) looks or gaps.
So far I’ve this and works in part. In pic an example where it doesn’t work.
1234567891011if longonmarket and condbuy and (reentry=1 or reentry=2) thensell positionsize contract at marketnewprice=closeif newprice=newprice+0.01 thenbuy positionsize contract at newprice stopelsebuy positionsize contract at newprice limitendifset stop %loss sllset target %profit ptlendif01/24/2021 at 11:55 PM #159305You can’t, unless you use the MTF support with a default 1-minute TF and BUY 1 minute after the previous position is closed.
This is because ProOrder needs one bar before knowing the updated OnMarket status.
1 user thanked author for this post.
01/25/2021 at 4:06 AM #159309Thnx roberto. that’s a shame. I don’t want to use MTF because that defeats the purpose.
But I’ve changed it a little. Removed the 0.01, the condition is always true.
It works often now. I will update progress on the concept in the vectorial dax topic.
1 user thanked author for this post.
01/26/2021 at 3:10 AM #159436Here’s the file i’ve been working on.
step1 & step2 use with cumulative orders set to true, optimising one or both steps to find good values to be used in step3.
step3 set cumulative orders to false for live trading
this is about seeing the trades that the normal backtest might not see because it is already on the market. Now those trades/signals have more meaning when optimising and always have impact. Best is to have all 3 equity-curves look similar (regardless the extra spread/trades with step1/2)
Maybe it will be useful and can be improved or maybe it’s not useful at all. I’am not sure yet.
example; dow 5m 100k optimised with a dpo setup for long
1 user thanked author for this post.
01/26/2021 at 7:37 PM #159532After having founded good & robust entry settings, added Roberto’s ts (disabled pt) and you have on (step3) a nice equity-curve on 200k. Maybe I shouldn’t have posted it here in this topic. But pretty good for an entry parameter with only 1 (best) value which is 100! Should be robust on vrt too I hope.
01/27/2021 at 5:46 PM #159596This is a really cool idea – comes close to incorporating VRT at the optimization level by using more of the possible entries. I’ll have to make some time to play around with it, thanks for sharing!
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on