Multi Timeframe problem

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #178557 quote
    pdrh
    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
    robertogozzi
    Moderator
    Master

    On Which instrument did you test it?

    pdrh thanked this post
    #178586 quote
    robertogozzi
    Moderator
    Master

    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
    pdrh
    Participant
    Average

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

    #178614 quote
    pdrh
    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
    pdrh
    Participant
    Average
    #178620 quote
    robertogozzi
    Moderator
    Master

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

    Thsnks 🙂

    #178621 quote
    robertogozzi
    Moderator
    Master

    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.

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 robertogozzi
4 years, 4 months ago.

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