Help with code for trading hours

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14442 quote
    peterduk
    Participant
    New

    Hi, can anybody help with a line of code which will only allow my automated trade to execute between the hours of  8am & 8pm?

    Thank you.

    #14443 quote
    Stef
    Participant
    Average
    defparam flatbefore=080000 // don't trade before 8am
    defparam flatafter=200000 // don't trade after 8pm
    #14448 quote
    Stef
    Participant
    Average

    or

    if opentime>=080000 and opentime<=200000 and otherbuyconditions then
    buy x contracts at market
    endif
    #14454 quote
    peterduk
    Participant
    New

    Thank’s Stef, I’ve used your first coding suggestion and it works a treat!

    #14456 quote
    Stef
    Participant
    Average

    😉

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

Help with code for trading hours


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
peterduk @peterduk Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Stef
9 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/07/2016
Status: Active
Attachments: No files
Logo Logo
Loading...