Help with code for trading hours

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #14442 quote
    peterdukpeterduk
    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
    StefStef
    Participant
    Average
    defparam flatbefore=080000 // don't trade before 8am
    defparam flatafter=200000 // don't trade after 8pm
    #14448 quote
    StefStef
    Participant
    Average

    or

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

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

    #14456 quote
    StefStef
    Participant
    Average

    😉

Viewing 5 posts - 1 through 5 (of 5 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

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 StefStef
9 years, 11 months ago.

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