Entries using daily bars

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12447 quote
    Dymjohn
    Participant
    Senior

    Hi All,

    I have written a strategy using daily bars to fix the entry price. I don’t think my code is working correctly can someone explain why my code took a trade at midnight when the previous day’s low had not been exceeded. Is it because at midnight it still considers Friday as the previous day? As an example trading GBPUSD on the 10 minute timetrame it took a trade at midnight(29-30th Aug)  at a price of 13104.6 but Monday low was 13059.8 whilst Friday low was 13122.0 on IG?

    // extension JAP change buy price on Mondays for Friday High/Low
    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    DEFPARAM FLATAFTER = 160000
    DEFPARAM PRELOADBARS = 2000
    LastEntryTime = 130000
    //ignore saturday and Sunday trading TD=Trading Day
    if DayOfWeek = 6 OR DayOfWeek = 7 THEN
    TD = 0
    else
    TD = 1
    endif
    //prices to enter trades
    if DayOfWeek = 1 Then
    BuyPrice = (DHigh(2)+3*PointSize)
    SellPrice = (DLow(2)-3*PointSize)
    else
    BuyPrice = (DHigh(1)+3*PointSize)
    SellPrice = (DLow(1)-3*PointSize)
    endif
    #12449 quote
    Nicolas
    Keymaster
    Master

    You should use GRAPH to see what happen. Firstly to correctly identify the Day(s)OfWeek with their good number. You could also GRAPH your BuyPrice and SellPrice variables to see if the calculation is made correctly the way you want it to.

    #12460 quote
    Dymjohn
    Participant
    Senior

    Thanks for your response Nicolas, I know the “buy” and “sell” prices work correctly so it must be that at midnight Monday into Tuesday considers Friday as the previous day . This is useful information going forward as it means “Midnight is considered part of the day that is ending”. I’ve just changed the code to Flatbefore 001000 and tested the strategy and it didn’t place a trade (aithough the trade was , thankfully,profitable). I’m not yet familiar with GRAPH will read up sometime.

    Regards

    John

    #12463 quote
    Nicolas
    Keymaster
    Master

    You’ll find how to use it in the documentation:

    http://www.prorealcode.com/documentation/graph/

    I also wrote a blog article: http://www.prorealcode.com/blog/debugging-probuilder-graph-instruction/

    GRAPH instruction is the only one that can be used for debugging purpose. If something is not functioning in your code, GRAPH will save you a lot of time to understand what is doing wrong.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Entries using daily bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Dymjohn @dymjohn Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/30/2016
Status: Active
Attachments: No files
Logo Logo
Loading...