How to make the damn thing trade only once per hour?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140696 quote
    PhilA
    Participant
    New

    Good morning,

    I want the strategy to run in 1 second time frame because I want it to trigger orders as soon as x crosses y.

    However, if x is going back and forth across y every few minutes, I don’t want it to keep trading in and out.

    So for that reason I want the strategy to only trade once per hour.

    How?

    Thanks, Phil

    #140700 quote
    Nicolas
    Keymaster
    Master

    With a condition based on elapsed BARINDEX since the last order for instance:

    if x crosses over y and barindex-lastbar >= 3600 then 
     buy at market 
     lastbar = barindex
    endif

    In this example you allow to enter the market only if 3600 bars (3600 seconds = 1 hour) have passed since the last order.

    Gubben thanked this post
    #140702 quote
    PhilA
    Participant
    New

    Thank you Nicolas you marvellous Frenchman.

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

How to make the damn thing trade only once per hour?


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
PhilA @phila Participant
Summary

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

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