How to buy one contract above pre-market high?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #210861 quote
    Mikael KMikael K
    Participant
    Junior

    Hi!

    I want to buy one contract in the DOW when it breaks above the high of the pre-market (high of 13:00-14:00 in my time zone). I only want it to take one order and tried using tradeindex, but now it is not taking any order. Help would be greatly appreciated!

    I have tried:

    defparam cumulateorders=false
    // breakout on DOW take one order per day after 14:00 at the high of the 13:00-14:00 hour bar
    timeframe(1hour)
    c1 = (longonmarket=0)
    c2 = time>140000 and time<150000
    c3 = high[1]
    c4 = tradeindex=0
    if c1 and c2 and c3 and c4 then
    buy 1 contract at c3 stop
    endif
    
    Sincerely
    /Mikael
    #210870 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    The 1-hour timeframe executes strategies only once in an hour, 13, 14, 15, etc… so there can’t be any time >14 and <15.

    Line 5 should read either:

    c2 = time>=140000 and time<=150000

    or (which seems to be a better choice):

    c2 = time=150000

    Of course you will have to add a condition to exit a trade, or it will remain open forever.

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

How to buy one contract above pre-market high?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Mikael K @mikael-k Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by robertogozzirobertogozzi
3 years, 6 months ago.

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