How to open and close in 1 bar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #146271 quote
    Paulchal
    Participant
    Average

    Hi

    Any idea what the code is to open and close a position in 1 bar.

     

    Many thanks

    #146272 quote
    robertogozzi
    Moderator
    Master

    You have to use MTF (Muti Time Frame) support.

    If you are using 1-hour TF to open a position you can use 1-minute (or lower) TF to exit on minute ore second 59:

    Timeframe (1h,UpdateOnClose)
    If MyConditions Then
       Buy at market
    Endif
    Timeframe (default)
    If LongOnMarket and OpenMinute = 59 Then
       Sell At Market
    Endif
    icharttop thanked this post
    #146274 quote
    robertogozzi
    Moderator
    Master

    This topic is about a strategy, not a screener, so I moved it to ProOrder support.

    Next time try to use the correct support forum, please.

    Thanks 🙂

    #154521 quote
    pp_playaflamenca
    Participant
    Junior

     

    If not at the end of the same candle, what about at the beginning of the next candle?

    What if we define for exiting long (or short) position conditions: (for backtesting purposes)

    close>= opening price

    close<opening price

    (any condition to be acomplished, to ensure every position opened at the beginning of the candle will be closed at the beginning of the next candle)

    I’ve tried to do like this, but it seems not to work I don’t know why   (it seems to work just for the first candle an order is opened,… but probacktest don’t open any order more later than this first time the first order is opened and closed) Thank you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

How to open and close in 1 bar


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Paulchal @paulchal Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by pp_playaflamenca
5 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 10/03/2020
Status: Active
Attachments: No files
Logo Logo
Loading...