How to stop automated trading at 22.00 on a daily timeframe?

Forums ProRealTime English forum ProBuilder support How to stop automated trading at 22.00 on a daily timeframe?

Viewing 4 posts - 1 through 4 (of 4 total)
  • #52006

    How can help my to close my stategy !!!

    I have a strategy on daily basis, I do not give start time.

    But I would like my closing order to close at 22:00 every day.

    This does not work with DEFPARAM FLATAFTER = 22000

     

    Harry

    #52056

    22:00 hour must be read by your code, if you are trading on a daily timeframe, this hour will never be met by the code, so the FLATAFTER instruction will not operate.

    #52091

    Hoi Nicolas

    Thanks for you anwser.

    But do you now how I can close my position every evening ?

    This is wat i test.

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    //DEFPARAM FLATBEFORE = 090000
    //DEFPARAM FLATAFTER = 220000

    // Conditions to enter long positions
    //indicator1 = Average[50](close)
    //c1 = (close > indicator1)
    //c2 = (open > close)

    //IF c1 and c2 THEN
    //BUY 1 CONTRACT AT MARKET
    //ENDIF

    // Conditions to enter short positions
    indicator2 = Average[50](close)
    c3 = (close < indicator2)
    c4 = (close < open[1])

    IF c3 and c4 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF

     

     

    #52178

    This is sadly a mayor shortcoming of the current PRT version. We lack a function to sell on the close. I miss this often. For example it is impossible for a strategy running on daily bars to close a position friday night to be flat over the weekend. A market order will always be executed at the open of the next bar and limit or stop orders are useless because you can’t know where prices will be at the end of the day.

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

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