How to make ProOrder only trade between set times

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #58955 quote
    jbyrne
    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
    GraHal
    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
    jbyrne
    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.

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 jbyrne
8 years, 1 month ago.

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