unknown specific day in the month

Forums ProRealTime English forum ProOrder support unknown specific day in the month

Viewing 12 posts - 1 through 12 (of 12 total)
  • #228076

    Hi everybody,

    after the big short candle of today due to the CPI data, I’d like to add in my strategies some lines to avoid any new trade in the period around the news.

    For Jobless data it’s easy because the news is always on Thursday all weeks.

    But for other news (Payrolls or CPI or RetailSales) that are, for example, only on the 2nd Tuesday of the month what do I have to write?

    Which are the instructions to let it know to avoid ONLY the second Tuesday ?

    Many thanks for your help

    #228080

    Hi MaoRai,

    You could make some sort of loop which traces backwards (to) the 1st day of the month (Month <> Month[1]) and then looks forward for the 2nd Tuesday, starting 1 day further than what you found tracing backwards.
    More easy could be to just hard code the dates (see below for a list already there – you can extend it yourself of course).

    Regards,
    Peter

    1 user thanked author for this post.
    #228082

    Hi,

    many thanks for your prompt reply.

    I’m unable to write the loop. I hope at Roberto or Nicolas will help me in that.

    Where did you get the sheet with the various dates of news ?

     

    #228084

    Here you go : https://www.bls.gov/schedule/news_release/cpi.htm

     

    1 user thanked author for this post.
    #228092

    Hi
    You could calculate wich tuesday it is with this code:

    #228096

    I shall be honest … I have been trying for 45 minutes or so, and couldn’t do it in that time.
    Then I saw your post, Iván, tried that, but unfortunately that doesn’t do a job either. Now 15 minutes later with your code as a base, I am going to give up and have a beer instead. 😜

    To let it work, (please) show a fully working snippet and point (Graph) at the 2nd Tuesdays of the month. Do you need a TimeFrame command, then inject that too.

    A strange beast this is !

     

    #228097

    Hi Ivan,

    thanks for your code but I don’t think it’s my request.

    I need a code that:

    • if the dayofweek=2 and (it is the second Tuesday of the month) and (hour=>14 and hour<=15) THENNoTrade=1

      Else

      NoTrade=0

      ENDIF

    • // where notrade=1 means not opening any trade in that day and hours

     

    #228106

    Hi,

     

     

    1 user thanked author for this post.
    #228109

    Sorry, for the hourly part I looked at it as not trading for one hour between 14h and 15h, but it seems you actually meant for 2 hours, not one. Although depending if you used hour in its PRT meaning of candle closing time, or as a word, I am not sure if you meant no trade between 13h and 15h, or between 14h and 16h.

    If from 13h to 15h, please replace “and openhour=14 then” in line 1 by “and (openhour=13 or openhour=14) then

    If from 14h to 16h, please replace “and openhour=14 then” in line 1 by “and (openhour=14 or openhour=15) then

     

    1 user thanked author for this post.
    #228118

    Hi JC – I am sure this is perfect. Very well done. No trading in the hour of PCI data (which comes in at 15:30).
    For MaoRai : don’t forget about the Daylight Savings difference between Europe (the area you imply) and the USA (which designates the PCI report at 08:30).

    #228121

    Just in case, about the Daylight Saving :

     

    #228132

    No trading in the hour of PCI data (which comes in at 15:30).

    No PeterSt … that is 14:30.

Viewing 12 posts - 1 through 12 (of 12 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login