Monthly timeframe – trade not showing

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #167878 quote
    Finning
    Participant
    Veteran

    Hi there,

    just a quick one, and I’m sure that it has a quick answer.

    A quick and simple code, essentially giving an insight into monthly seasonality in a sense.

    On monthly bars, I run the following code – and in this instance, I wanted to test for April month historical performance:

    if month=4 then
    buy at market
    endif
    
    if longonmarket then
    sell at market
    endif
    

    What I’m seeing though, if I run the code, a position isn’t opened for this current month of April.

    I can understand that the profit/loss wouldn’t show up yet, because the trade is not closed at the start of the new month of May – that’s fine/obvious – but it is showing that the trade isn’t even opening at all at the start of April??

    Along the same lines, if I change the above code so that month=3 and I open at the start of March, then it looks like the start of April isn’t even registering to close the trade?? A picture of this is attached too.

    The pictures attached are DAX. Have tried on heaps of indexes and some forex, and seems to have the same problem?

    Not that I’d trade a CFD on a monthly basis, but I just want to know what is going on.

    Thanks,

    Finning.

    April.jpg April.jpg March.jpg March.jpg
    #167882 quote
    robertogozzi
    Moderator
    Master

    It’s because the OnMarket status is updated when the candle closes. On or after May 1st 2021 you will see the arrow under April 2021.

    Try this version on the Daily TF, always setting the current day (candle being formed) as the trading day and you will see  everything is fine for the previous periods, not the current one (which will be updated tomorrow):

    if day = 23 then//month=4 then
    buy at market
    endif
    
    if longonmarket then
    sell at market
    endif
    #167884 quote
    Finning
    Participant
    Veteran

    Hi Roberto,  thanks, will try.

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

Monthly timeframe – trade not showing


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Finning @finning Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Finning
4 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/23/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...