one trade an hour on minute bar system

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #212477 quote
    filemon1982
    Participant
    New

    Hi, fellow traders.

    I’ve made a breakout system on a minute bar chart.

    However, I want at max one trade on each hour frame.

    For example, when an order is executed at 16:05, and the stoploss/ gain is hit before 17:00, I don’t want the system to start a new trade ( if the variables are met) before 17:00.

    On the other hand, if the stoploss is not hit before 17:00 it should stay open.

    The reason I try to work with a minute bar system is because that way the ystem reacts faster on a  break-out ( with hour bars, you have to wait until the next hour).

    Is there a way to do this?

    kind regards,

    #212506 quote
    JS
    Participant
    Senior
    Hi,

    Do you really want a maximum of 1 transaction per hour or do you want a maximum of 1 transaction every hour…

    1. Transaction closed at 16:15 then the next transaction can take place after 17:15… (no transaction for a whole hour)

    1. Transaction closed at 16:15 then the next transaction can take place after 17:00… (part of an hour no transaction)
    #212510 quote
    filemon1982
    Participant
    New
    Hi JS,   Thanks for the reply. I’m looking for a solution like your second option ( number 2).   Kind regards,
    #212519 quote
    JS
    Participant
    Senior
    Hi, Try this one…
    DefParam CumulateOrders=false
    
    If NOT OnMarket and (BarIndex - TradeIndex(1)) < CurrentMinute then
    TradeOn = 0
    Else
    TradeOn=1
    EndIf
    
    If MyConditions and TradeOn=1 then
    Buy 1 contract at Market
    ...
    
    #212520 quote
    filemon1982
    Participant
    New
    Thank you JS,   I’ll try the code this evening at home and I’ll keep you posted!   regards,
    #212587 quote
    filemon1982
    Participant
    New
    Unfortunate, it didn’t work out. The system kept generating orders during the same hour ( after the stoploss or stopgain was hit). regards,
    #212609 quote
    JS
    Participant
    Senior

    Hi,

    That’s strange because it works for me…

    Maybe the cause is in another part of your code…?

    Scherm­afbeelding-2023-03-31-om-14.10.46.png Scherm­afbeelding-2023-03-31-om-14.10.46.png
    #212638 quote
    filemon
    Participant
    New
    No, I just forgot to adjust the part in line nr. 9. It works great! thanks
    JS thanked this post
    #212640 quote
    JS
    Participant
    Senior

    After I thanked you (thanks) your “topic count” went from 1 to zero…

    And your replies went from 3 to 1…

    I better not thank you… 😉

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

one trade an hour on minute bar system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by JS
2 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/30/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...