buy at the open sell at the close

Forums ProRealTime English forum ProOrder support buy at the open sell at the close

Viewing 13 posts - 1 through 13 (of 13 total)
  • #124631

    Hello everyone! I was wondering if someone could help me with some issue that I haven’t been able to go around. using a Daily chart I want to buy at the open of the day and sell right before the close, not at the nest opening. Could anyone help me with the programming or indicate me how it could be done?

    I will be grateful for any help, cheers!

    #124632

    juan Sansesa – Welcome to the forums. Your question is strategy related so should be posted in the ‘ProOrder’ forum and not the ‘General Disscusion’ forum. I will move your topic but please try to be more careful when posting future topics.

    #124641

    Strategies are ALWAYS executed AFTER (or WHEN, no difference) a candle closes, so you can exit your trades at this time, which is the same time the new candle opens (apart at the end of the week or for instruments not trading 24 hours).

    As for the exit price, it will be the current price when the new candle opens. If there are gaps, well … you will suffer them.

    If you are on a daily TF and close your trade at the close of Friday evening, when the order is received, the market is already closed (it’s just a few milliseconds), so your trade will be closed the next time the market is opened. On Friday night your exit order will be executed next Monday (or Sunday). IG might behave differently (I never tested this) because THEY make the market with their CFD’s so they could stay open a few more seconds or minutes just to let people accomplish that.

    Using MTF (Multi Time Frame) support so that you operate on, say a 1-minute TF, might allow you to close your trade 1 minute before the day closes. But… in that minute price could change and it could NOT be the same as the closing price.

    If you better explain what’s your idea we could try to find out a different way to address your problem.

     

    #124642

    This question has been asked twice this week in the English ProOrder forum. It is quite a common question from new platform users. The answer is as Roberto said in the use of MTF in your strategy. With MTF you can make decisions on say the daily time frame and based on indicators applied on the daily time frame but make the entry in a faster time frame. There are some issues to consider however – for example if you use the 1 second time frame if there is no 1 second candle then your strategy will not open a trade. Also you get a lot less data to back test on when operating on a faster time frame.

    #124697

    To start I would like to thank you both Vonasi and Roberto for your help and fast response I really appreciate it (and sorry for not posting this comment correctly). Concerning the specifics of the strategy as Roberto asked. It is the following: I want to buy gold (GLD or XAUUSD) at the open on Fridays, and sell right before the close on Fridays, the code that I wrote is this one:

     

    Thank you very much again for your help and time ! kind regards !

     

    #124698

    juan Sansesa – Please always use the ‘Insert PRT Code’ button when posting code in your replies. I have tidied up your post for you. 🙂

    Your code will not close the trade at the end of Friday and is not an MTF strategy. The next open when orders will be filled will be Sunday or Monday depending on what you are trading and your position will be open till then.

    This code will buy at the open of Friday and sell 1 minute before the end of Friday. Obviously if what you are trading closes earlier then alter the exit time to match. You must launch it on the 1 minute timeframe and as said before this seriously limits the amount of back test data available to you. Also if there is no 1 minute bar at the end of the day then it won’t sell until there is one on the Sunday or Monday.

     

    #125336

    Thank you very much Vonasi! ill try it this way !

    Kind regards !

     

    #153899

    Unfortunately, I’m sorry to say this solution (Vonasi’s 1 minute  multiframe) to open orders at the beginning of the day and to close this order at the end of the day,  really   limits seriously indeed the amount of back test data available to you….. So, what if I want to run a BACKTEST in daily charts for any strategy of this kind, opening at the beginning of the daily bar and closing position at the ending of the daily bar? Would you helpme,  please?? Thank you

    #153900

    On a Daily TF, strategies ALWAYS open trades (for market orders) when a candle closes so the trade will be reported as belonging to the opening candle and if you sell it as soon as that new candle closes, your trade will be closed at CLOSING time (it will last just one day).

    The question above concerned the case when you want to close a trade BEFORE the Daily candle closes, say 1 minute before, in which case Vonasi’s solution is the only one available. You will have to work with a shorter data history for backtesting.

    Luckily the new version 11 has increased that limit (about twice as much for IG accounts and up to 1M bars for PRT accounts).

     

    #154003

    Thank you Roberto, you’re right of course. My problem in fact is easier:  I don’t really know how must I do to close at the end of the day the order has been opened at the beginning of the day (daily charts) for daily backtesting purposes (whatever the estrategy would be) . I guess must be trivial to solve, but I don’t know the answer actually. Could you tell me about it, please maybe? Thank you in advance.

    #154017

    It’s already been answered several time above, you need to use MTF with a lower TF.

     

    1 user thanked author for this post.
    #154081

    If you use a daily timeframe, your algo looks at the market only one time a day (not 2 or 3 times). At 1 AM.

    1 user thanked author for this post.
    #154520

    Yes, thank you Roger…. On the other hand, what if that I really want to do (for daily backtesting purposes) is closing at the end of fridays every position opened along the week, for daily charts backtesting (I stress that again, since 2018 until now for example)? How could it be the easier way to achieve this item, please? Thank you.

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

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