Autotrade triggers an entry before the Backtest entry

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #245024 quote
    pdrhpdrh
    Participant
    Average
    defparam cumulateorders = false
    DEFPARAM FLATBEFORE = 100000 //UTC
    DEFPARAM FLATAFTER = 155900 //UTC
    noentrybeforetime=101300
    noentryaftertime=160000
    timeenterbefore=time>=noentrybeforetime
    timeenterafter=time<noentryaftertime
    
    IF time = 160000 THEN // UTC Time
    EntryPrice = DClose(0)
    ENDIF
    N=2
    Start=100000
    If time=start then
    Lrt=0
    Srt=0
    St=0
    Lt=0
    Endif
    //Timeframe(1minutes,updateonclose)
    up = PRTBandsUp
    dn = PRTBandsDown
    if close crosses over up and trend <= 0 then
    trend = 1
    elsif close crosses under dn and trend >= 0 then
    trend = -1
    endif
    
    StartTrade=101300
    If Time=startTrade then
    OPN=open
    endif
    //OTD = (Barindex - TradeIndex(1) > IntradayBarIndex)
    IF Trend=1 AND Lt<1 and OPN >entryprice  and timeenterbefore and timeenterafter THEN//
    BUY N CONTRACT AT MARKET
    SL= lstp
    TP=ltgt
    Lt=Lt+1
    ELSIF trend=-1  AND St<1 and OPN< entryprice   and timeenterbefore and timeenterafter THEN//
    SELLSHORT N CONTRACT AT MARKET
    SL= sstp
    TP=stgt
    St=St+1
    ENDIF
    If longonmarket[1] and not onmarket and Strategyprofit[1]>strategyprofit and Lrt<1 and St<1 and trend=-1 then
    sellshort 1*N contract at market
    SL= Rlstp
    TP=Rltgt
    Lrt=Lrt+1
    endif
    If shortonmarket[1] and not onmarket and strategyprofit[1]>strategyprofit and Srt<1 and Lt<1 and trend=1 then
    Buy 1*N contract at market
    SL= Rsstp
    TP=Rstgt
    Srt=Srt+1
    endif
    set stop ploss SL
    set Target Pprofit TP
    
    Screenshot-2024-09-07-072302.png Screenshot-2024-09-07-072302.png
    #245026 quote
    pdrhpdrh
    Participant
    Average

    The White line is the previous days close

    #245057 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Add the ITF files, as some variables are missing.

    pdrh thanked this post
    #245061 quote
    pdrhpdrh
    Participant
    Average

    The White line is the previous days close which is the entry price in the code

    ASX-Daily-close-H-LV2.3-.itf
    #245124 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Dclose(0) is today’s closing price (the current price), the previous day’s closing price is Dclose(1).

    Iván González thanked this post
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

Autotrade triggers an entry before the Backtest entry


Platform Support: Charts, Data & Broker Setup

New Reply
Author
author-avatar
pdrh @pdrh Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
1 year, 5 months ago.

Topic Details
Forum: Platform Support: Charts, Data & Broker Setup
Language: English
Started: 03/19/2025
Status: Active
Attachments: 2 files
ProRealCode ProRealCode
Loading...