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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140696 quote
    PhilAPhilA
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    PhilAPhilA
    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.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

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 PhilAPhilA
6 years, 2 months ago.

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