How can I freeze running strategies?

Forums ProRealTime English forum ProOrder support How can I freeze running strategies?

Viewing 11 posts - 1 through 11 (of 11 total)
  • #9119

    A few minutes (or hours, according to the timeframe involved) before certain news I would like to freeze a running strategy without interrupting it and without closing open trades.

    I haven’t found instructions on how to manage that issue, so I decided to wrote a simple strategy than opens a trade each 1-minute-bar, continuosly (of course it is just for demo accounts so I don’t care whether it loses or gains) and, each bar, it CALLs a custom indicator (named FreezeStrategy) that simply returns 0 or 1.

    If it returns 0 my strategy just operates normally and continuosly opens and closes trades. If it returns 1 it STOPs opening new trades.

    My idea was to modify the Indicator a few minutes before the news (say 14:20 UTC+2 for NFP) so that it returns 1 and my strategy freezes. When I want my strategy to resume operating I should just modify it (and validate the code each time) so that it returns 0 again.

    It seems fine, but it DOES NOT work!!!  I guess ProOrder doesn’t actually CALL the indicator at each bar, but it CALLs it only when the strategy is started, so any change I may make to the code, the strategy is not affected.

    Is there any way to FORCE the strategy to CALL the indicator at each bar?

    Thank you for your help.

    ————————————————————————————————————————–

    Indicator (FreezeStrategy):

    RETURN 0       // 1 to freeze my strategy

    <hr />

    My strategy:

    DEFPARAM CumulateOrders = False
    IF LONGONMARKET THEN
    SELL AT MARKET                                                               // close any open trade, no matter if shows a profit or loss
    ENDIF
    Inactive = CALL FreezeStrategy
    IF( close <= close[1]) OR (close > close[1]) THEN         // open a trade no matter what
    IF Inactive = 0 THEN
    BUY 1 CONTRACT AT MARKET                                  // LONG trades just as an example
    ENDIF
    ENDIF
    SET STOP PLOSS 2
    SET TARGET PPROFIT 2

     

    #9120

    Hi Roberto, is hard to know without indicator code.

    I think you can do it also with something like this:

     

    #9121

    The code is above, just 1 line:

    RETURN 0       // 1 to freeze my strategy

    I don’t know if there is a minum requirement as to lines, do they require more than 1 line?

     

    As to your code, if you embed dates in your code you have to adjust them everyday or even more than once a day, thus interrupting the strategy.

    Maybe there is a way I haven’t read of so far!

    #9124

    Can’t get the point, you’re calling an indicator that gives you back always 0, so how is it working?

    You can set any date into your system in order to work exactly like you want (or should be).

    Cheers

    #9125

    IF LONGONMARKET AND ? AND TIME < 142000 AND TIME > 143000

    THEN SELL AT MARKET

     

    maybe something like this?

     

    #9144

    Isn’t this an option in preferences ?

    You have the option to keep orders and trades open.

    With this in mind you can temporarily stop the Auto Trade – whilst leaving positions open..

    I think this is correct…

     

    #9153

    The options just let me keep trades open, not pause and then resume my strategy.

    Setting as many dates and times in a strategy for, say, 2-3 months would imply several pages of code to evaluate each of them at each bar!

    I could temporarily solve the problem stopping the Auto Trade, but this will clear all statistics. Till I find a better solution I’ll use this one. Thanks.

    #9156

    Hi again 🙂

    Hope it helps you!

    #9157

    That would be fine once for specific news. At each crucial news I should recode it and replace the running one, which could be required once in a week or maybe twice in a day, depending on how many news are scheduled and when…

    I am looking for a piece of code to pause and resume a strategy without having to change the code and stop it, so that I could pause it at 10:25, resume it at 10:40. then pause it again at 14:20, then resume it again at 15:00 today and maybe at 11:00 or 16:30 Tomorrow or next monday.

    There are tens of important news each month and I would like a strategy to be fully operating without having to change the code each time.

    In my opinion just having to set 0 or 1 in an indicator would be great. I would have to change just one line of code as many times a day as I want without stopping the strategy and clearing statistics.

    A better solution would be if Auto Trade had another button “Pause/Resume”, you click it and the strategy would pause without starting new trades, just keeping an eye on pending orders and running trades in case a previously programmed action is required.

    Thank you Adolfo.

    #9185

    Hi Roberto, finnally understood :). Hope they will implement something like this in next versions.

    Best trading ever.

    #9200

    I hope so as well. Thanks Adolfo.

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