Highest price

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31692 quote
    Mikael SjöblomMikael Sjöblom
    Participant
    New
    
    DEFPARAM PreLoadBars = 0
    DEFPARAM FlatAfter = 215500
    If (currenttime=160000) then
    entry=1
    else
    entry=0
    endif
    
    // Conditions to enter long positions
    IF NOT LongOnMarket AND entry=1 THEN
    BUY 1 CONTRACTS AT MARKET
    ENDIF
    

    I wanna backtest a open drive failure strategy. I have managed to get the time entry condition to work but can’t seem to find a way to entry only if the opening price at 15:30 is

    the highest at 16:00 since 15:30. I also wanna know if it is possible to set my target to the opening price of the 15:30 bar.

    To clarify:

    1: Is there a code to only entry the trade if 15:30 open is still the highest point in the last half hour?

    2: Is it possible to set my target to the opening price of the 15:30 bar?

    #31695 quote
    ElsborgtradingElsborgtrading
    Participant
    Veteran

    Hi Mikael I am not sure I understand you correctly about the opening at 15:30 but for the highest price between 15:30 and 16:00 you would need to run it on a specific timeframe- let say 15 min

    it could be something like this- I didn’t test it though

    cheers Kasper

    if current time >=160000 and current time <=161500
    tradetime=1 
    else
    tradetime=0
    endif
    myhigh= highest[2]high (close)
    
    if tradetime and open>myhigh then
    buy 1 contract at market
    endif
    #31708 quote
    Mikael SjöblomMikael Sjöblom
    Participant
    New

    Hello! What I mean when I said opening at 15:30 is the opening price of the 15:30 bar. I look to use this strategy at the US opening in Sweden.

    I tried  to use the code you gave me and I think your are onto something but i get an error on 1 and 3. I tried to add “then after 161500 on line 1 but still gets the error.

    I will look at it more this tonight but I appreciate you reply.

    Cheers

    #31858 quote
    ElsborgtradingElsborgtrading
    Participant
    Veteran

    Hi, it was a syntax error. I was not near PRT but wrote it from memory.. (not selling myself very well here- I know :-))

     

    try this

    if currenttime >=160000 and currenttime <=161500 then
    tradetime=1
    else
    tradetime=0
    endif
    myhigh= highest[2](high)//is the highest"high" from the last two periods- which is 30 min- hence the 15 min timeframe. adjust accordingly
    
    if tradetime and open>myhigh then
    buy 1 contract at market
    endif
    Mikael Sjöblom thanked this post
Viewing 4 posts - 1 through 4 (of 4 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

Highest price


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by ElsborgtradingElsborgtrading
9 years, 5 months ago.

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