closing operations at the end of the candle

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #55218 quote
    Juan SalasJuan Salas
    Participant
    Master

    Hi colleagues,

    One simple questions: I am operating in 4h candles and I want to open and close operations at the beginning and the end of the bar, regardless the outcome. I think I know the answer but I see ackward results in the backtest.

    Example: 090000 bar.

    IF time=090000 AND my conditions THEN

    BUY 1 CONTRACT AT MARKET

    ENDIF

    Now, to close this operation at the CLOSE of the candle (4 hour), shall I refer to 125900 or 130000???

    IF time=XXXXXX THEN

    SELL AT MARKET

    ENDIF

    Thanks,

    Juan 

     

    #55468 quote
    NicolasNicolas
    Keymaster
    Legend

    Time refer to the Close of the bar. Code is only read once at Close. You can also use OpenTime which is the time of the bar where the code is read.

    Juan Salas thanked this post
    #55469 quote
    Juan SalasJuan Salas
    Participant
    Master

    Nicolas,

    Thanks so much as always,

    Juan

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

closing operations at the end of the candle


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Juan Salas @juan-salas Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Juan SalasJuan Salas
8 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/09/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...