How to make ProOrder only trade between set times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #58955 quote
    jbyrnejbyrne
    Participant
    Average

    Hi, quick question, how can I get my code to only trade between certain hours of the day? I’d like my system to start trading at 9am then stop at 15pm. I have tried to use the ‘CurrentTime’ example listed in the ProRealTime Documentation but when I copy paste the code into my code it doesn’t work, I get a red line under ‘Return’.

    Here’s my code;

    defparam CUMULATEORDERS = false
    
    IF (CurrentTime = 090000) THEN
    WakeUp = 1
    ELSE
    WakeUp = 0
    ENDIF
    
    RETURN WakeUp
    
    EMA25 = ExponentialAverage[45](close)
    EMA50 = ExponentialAverage[200](close)
    
    cBuy = (EMA25 crosses over EMA50)
    cSell = (EMA25 CROSSES under EMA50)
    
    
    
    Percentage = 7
    
    Bull = close > (DClose(1) * (1 + (Percentage/100)))
    Bear = close < (DClose(1) * (1 - (Percentage/100)))
     
    IF Bull and cBuy THEN
    BUY 1 Contract AT Market
    ENDIF
     
    IF Bear and cSell THEN
    SELLSHORT 1 Contract AT Market
    ENDIF
    
    set target %profit 3
    set stop %loss 0.75
    
    

    Thanks in advance

    #58958 quote
    GraHalGraHal
    Participant
    Master

    You don’t need Return and you are not using WakeUp in your code?

    Try this

    https://www.prorealcode.com/documentation/flatafter/

    jbyrne thanked this post
    #58959 quote
    jbyrnejbyrne
    Participant
    Average

    Hi, Thanks for the help but I figured it out.

    I’ll delete this post now to avoid any confusion.

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

How to make ProOrder only trade between set times


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
jbyrne @jbyrne Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by jbyrnejbyrne
8 years, 8 months ago.

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