Variable optimisation for times of day

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #134380 quote
    teapot2002
    Participant
    Average

    I have code that opens a trade at 080000, and I’d like to see whether 080500, 081000 etc is better, ie I’d like to be able to optimise a time variable during the variable optimisation. I’ve tried putting times like 080500 into the ‘Cable in program’ box in the Definition of Variables dialogue box, but with no success.

    Is it possible to do this, and if so, how?

    Thanks

    #134411 quote
    GraHal
    Participant
    Master

    Try 000000 230000 010000 in the Optimiser to optimise to nearest 1 hour then narrow it down to nearest 1 minute etc.

    Time = xx

    OR

    Hour = xx

    and enter … 0 23 1 in the optimiser

    #134461 quote
    teapot2002
    Participant
    Average

    I got it working. Thank you for that.

    GraHal thanked this post
    #219354 quote
    banjoo78
    Participant
    New

    Hi,

    I’ve the same problem. Can you share the code please?

    thank you!

    #219368 quote
    GraHal
    Participant
    Master
    For Time >= xxxxxx

    Try min = 000000 max = 230000 and step = 010000 (in the Optimiser to optimise to nearest 1 hour then narrow it down to nearest 1 minute etc).

    For Hour = xx
    Try min = 0  max = 23 step = 1 (in the optimiser)
    If you need more explanation, just say which bit you don’t understand? Code could be something like either of below …
    If Time >= 080000 Then
    Buy at Market
    Endif
    
    If Hour = 140000 Then
    Buy at Market
    Endif
    banjoo78 thanked this post
    #219370 quote
    GraHal
    Participant
    Master
    Hour = xx code should read as below
    If Hour = 14 Then
    Buy at Market
    Endif
    banjoo78 thanked this post
    #219371 quote
    banjoo78
    Participant
    New
    For Time >= xxxxxx
    Try min = 000000 max = 230000 and step = 010000 (in the Optimiser to optimise to nearest 1 hour then narrow it down to nearest 1 minute etc).
    For Hour = xx
    Try min = 0 max = 23 step = 1 (in the optimiser)
    If you need more explanation, just say which bit you don’t understand? Code could be something like either of below … Thank you so much! I’m able to optimize with hours (I set 0-23 in optimizer) but not with time: in the optimizer I can’t set 000000 ’cause it replace with 0.
    I have to set pace 10000 (without first 0) so, the time will be 10000, 20000 etc
    I wrong something?
    thx
    #219375 quote
    GraHal
    Participant
    Master
    so, the time will be 10000, 20000 etc
    Above is okay, so 10000 is 1 am in the morning.  The Optimiser disregards leading 00’s, but it still works as a variable value in the code. 0 is also okay as that is midnight (000000). We are kidding the Optimiser into working for us! 😉
    banjoo78 and robertogozzi thanked this post
    #219376 quote
    banjoo78
    Participant
    New
    Thank you GraHal!
    GraHal thanked this post
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

Variable optimisation for times of day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
teapot2002 @teapot2002 Participant
Summary

This topic contains 8 replies,
has 2 voices, and was last updated by banjoo78
2 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/03/2020
Status: Active
Attachments: No files
Logo Logo
Loading...