How to open immediately a position
Forums › ProRealTime English forum › ProOrder support › How to open immediately a position
- This topic has 10 replies, 3 voices, and was last updated 7 years ago by
Lorenzo47.
-
-
02/11/2018 at 12:51 PM #62246
Hello everyone,
I work on a very simple scalping code based on Parabolic SAR, the key of my strategy is to be very reactive once this indicator changes. (For information I’m on 1 minutes periods)
Is it possible to open a position at the exact moment when the requested condition realizes (without waiting for the end of the current period) ? I understand that in my code, I always refer to a close which forces the algorithm to wait until the current candle closes. I’d like to know if it’s possible, just as the Stop Loss and Target Profit do, to open a position exactly when the condition happens.
To make my strategy works I need to open a position exactly when my SAR indicator hits the market price.
Here’s the problematic line :
Condition 1 SAR1c1 = (SAR CROSSES UNDER High)I know that “high” means that we need to wait until the end of the period for closure, is there any solution to open my position when the SAR crosses under, or “hit the price” ?
Attached, how it impacts the chart on BackTest : my position is opened one candle too late.
If anyone can help me with this, it would be amazing of you!
Thanks a lot, looking forward to get your advices 🙂
02/11/2018 at 1:10 PM #62253try this https://www.prorealcode.com/topic/activate-a-trade/#post-60660
change highest high to SAR instead (or lowest for sell)
02/11/2018 at 1:43 PM #6226002/11/2018 at 5:45 PM #6228702/11/2018 at 5:45 PM #6228802/12/2018 at 2:04 PM #62429Pending STOP ORDERS:
123mysar = SAR[0.02,0.02,0.2]sellshort at mysar stopEach new candle, a new conditional SELLSHORT order will be placed at the exact SAR price. This order will take place in the broker’s order book and could be triggered if the price breach its level, even between 2 candlesticks.
1 user thanked author for this post.
02/12/2018 at 2:46 PM #62436Alright, thank you so much. I’m going to try this out and hopefully it will help! Anyways, as I understood there is no other way to do so far, so I will need to deal with that “hole” and adapt my strategy… Hopefully we will get soon a way to execute the calculation at each ticks no matter how big are the periods. It could help me a lot! 🙂 Thank you for your time
02/12/2018 at 5:59 PM #62466Pending STOP ORDERS:
123mysar = SAR[0.02,0.02,0.2]sellshort at mysar stopEach new candle, a new conditional SELLSHORT order will be placed at the exact SAR price. This order will take place in the broker’s order book and could be triggered if the price breach its level, even between 2 candlesticks.
I tried this but I can’t get the result I was expecting. Actually the algorithm takes a lot of positions at the wrong time (never when “the price hits the SAR point”). I guess it doesn’t put the stop order on the “SAR point” but why I can’t figure it out.. Here’s the “test” code I tried, maybe it’s something very obvious but I really can’t see it.
123456789101112131415// Indicators SettingspSAR = SAR[0.02,0.02,0.2]// Opening buy conditionsBUY 1 CONTRACTS AT pSAR STOP// Opening sellshort conditonsSELLSHORT 1 CONTRACTS AT pSAR STOP//Stops and TargetsSET STOP pLOSS SLSET TARGET pPROFIT TPSET STOP pTRAILING ST02/19/2018 at 9:55 AM #6310702/19/2018 at 11:13 AM #6312802/25/2018 at 3:49 PM #63894Nicolas, yes the SAR settings are exactly the same.
Eric, thanks and yes I’ve obviously done that.
The pending orders are working not bad, it needs some adjustments (as every strategy as guess) due to the big unknown.. But so far I think that’s the best solution to it. And btw, just to share it with you guys, I forgot to enable “tick per tick mode” which cost me some mistakes on my stops trailing. Shame on me!
PS : sorry for not having replying, I was out of the country for business
-
AuthorPosts
Find exclusive trading pro-tools on