Wait 30 seconds within a candle

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #183703 quote
    gfx
    Participant
    Average

    hi gents,

    I am struggling with trying to pause my strategy for 30 seconds after signal is triggered.

    my system runs on a 2H minute TF with update on close.

    My first idea was to use a loop for next. But quite difficult to evaluate the loop size to 30 seconds. Also, quite depending on the CPU running loop.

    Does it exist a way to pause 30 seconds after the last candle closed and the ProOrder was triggered  ?

    Thks,

    gfx

    #183707 quote
    robertogozzi
    Moderator
    Master

    You can only achieve your goal with the help of Multi Time Frame support which enables you to use a 30-second TF as default, so that you just need to wait 1 candle after a signal is returned.

    #183963 quote
    Nicolas
    Keymaster
    Master

    You could also use a time difference by using TIMESTAMP in any timeframe below the 30 seconds TF.

    #184404 quote
    gfx
    Participant
    Average

    hi all,

    Happy new year to all !

    Thank you for all your answers. They are interesting option.

    On concern on my side, not in my initial post is that all occurs in a while loop …

    In a nutshell …

    x = 1

    While x < 10

    try

    pause …. a few seconds …

    x = x +1

    wend

     

    as part of a while loop I can’t rely on any candle end trigger, of any time frame. All occurs whithin a single candle trigger

    #184424 quote
    robertogozzi
    Moderator
    Master

    This code waits for a condition to be met on a 1-minute TF, but it wants to wait 10 seconds before entering at market. A 1-second default TF must be used to run it:

    Timeframe(1 minute,UpdateOnClose)
    Flag = 0
    if close crosses over average[10] and not OnMarket then
      Flag = 1
    endif
    if close crosses under average[10] and OnMarket then
       sell at Market
    endif
    set stop   ploss   20
    set target pprofit 60
    //---------------------------------------------------
    Timeframe(default) //1 second)
    IF Flag = 0 THEN
       Tally = 0
    ELSE
       Tally = Tally + 1
       IF Tally = 10 AND Not OnMarket THEN
          BUY 1 contract at market
       ENDIF
    ENDIF
    graph Flag
    x.jpg x.jpg
    #184632 quote
    gfx
    Participant
    Average

    Thks. Still it won’t work in my situation as I am still in a while loop including other conditions than time.

    A good idea though. I’ll give it some thoughts and try to adapt my code.

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

Wait 30 seconds within a candle


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
gfx @gfx Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by gfx
4 years, 1 month ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/21/2021
Status: Active
Attachments: 1 files
Logo Logo
Loading...