How to open immediately a position

Forums ProRealTime English forum ProOrder support How to open immediately a position

Viewing 11 posts - 1 through 11 (of 11 total)
  • #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 :

    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 🙂

    #62253

    try this  https://www.prorealcode.com/topic/activate-a-trade/#post-60660

    change highest high to SAR instead (or lowest for sell)

     

     

    #62260

    You can put pending orders on Sar levels, so they can triggered anytime between 2 bars.

    1 user thanked author for this post.
    #62287

    Thanks Eric but I don’t think it’s going to help.. And by putting a stop I have one chance out of two to get the position at the wrong moment, for a scalping strategy I’m not sure it’s the best but thank you anyways

    #62288

    Nicolas, Pending orders ? Very interesting, I did not know about this, could you explain me how it works and how to set one in my code to try if it works ?

    #62429

    Pending STOP ORDERS:

    Each 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.
    #62436

    Alright, 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

    #62466

    Pending STOP ORDERS:

    Each 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.

     

     

    #63107

    Are the SAR settings of the strategy the same as the one of the indicator displayed on your chart? (0.02,0.02,0.2)

    #63128

    dont forget to adjust for the spread

    its always bid and ask that trigger the trade when using stoporder

    and sar is based on price only

     

     

    #63894

    Nicolas, 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

Viewing 11 posts - 1 through 11 (of 11 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login