Multi Timeframe problem

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #178557 quote
    pdrhpdrh
    Participant
    Average
    DEFPARAM FLATAFTER = 160000
    
    // Prevents the system from creating new orders to enter the market or increase position size before the specified time
    noEntryBeforeTime = 100200
    timeEnterBefore = time >= noEntryBeforeTime
    
    // Prevents the system from placing new orders to enter the market or increase position size after the specified time
    noEntryAfterTime = 160000
    timeEnterAfter = time < noEntryAfterTime
    
    ONCE Start=100000
    If Time =start then
    Tradecount=0
    Endif
    Timeframe (30minutes,updateonclose)
    c1= (close[1]-open[1] )
    c2=c1<0
    Timeframe (default)
    c3=SAR[0.02,0.02,0.2]
    c4=close>c3 AND close>open
    c5=close <supertrend[3,6]
    IF c2  AND c4 And c5 AND Tradecount<1 AND timeEnterBefore AND timeEnterAfter THEN
    SELLSHORT 3 CONTRACT AT MARKET
    Tradecount=Tradecount+1
    ENDIF
    
    // Stops and targets
    SET STOP pTrailing 16
    SET TARGET pPROFIT 3.4

    A trade is being triggered when the condition in the 30 minute timeframe is not met and I can’t see why .The default timefame is 20 seconds.

    Any help greatly appreciated.

    [attachment file=”Sell SAR.itf”]

    #178566 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    On Which instrument did you test it?

    pdrh thanked this post
    #178586 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It works fine for me.
    I suggest that you append these lines at the end of your code:

    graph c2
    graph c1

    so that you can monitor their value when the trade enters (actually the candle BEFORE the arrow plotted by ProBackTest).

    pdrh thanked this post
    x-18.jpg x-18.jpg
    #178611 quote
    pdrhpdrh
    Participant
    Average

    I am running this on the ASX200 . Doesnt seem to work as well on other indices

    #178614 quote
    pdrhpdrh
    Participant
    Average

    [attachment file=”178615″]
    The problem is that the 30 minute calculation is being done on 2 bars before the current bar .

    The entry on 27th Sept is at 10:49 but the C1 value is the the value for the 9:30 bar on the 30 minute chart.

    I need some help to insert a screen print into my reply

    Sell-SAR.xlsx
    #178617 quote
    pdrhpdrh
    Participant
    Average
    #178620 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Do not insert pics in your posts, only attach them using the appropriate button.

    Thsnks 🙂

    #178621 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It’s important, back to your question, that conditions are met on the 30-minute TF when the trade is entered.

    There are 90 20-second bars in 30 minutes, so more trades can be opened before the next 30-minute bar opens.

    C2 is met for 30 minutes.

    pdrh thanked this post
Viewing 8 posts - 1 through 8 (of 8 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

Multi Timeframe problem


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
pdrh @pdrh Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
5 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/27/2021
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...