three trades per hour max

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #32121 quote
    BestAlgoTrader
    Participant
    Junior

    Hello,

     

    I would like my trading system to place no more than 3 trades in any given trading hour.

    For example it will be placing trades throughtout the day, but if it places 3 trades during 3-4PM then i wnt it to no place anymore trades until it reaches 5pm

    i dont want it to be able to place like 5-1o trades in a short pace of time so i need to limit it to place no more than 3 per hour

     

    IF anyone knows the code to use to do this please let me know

    I have some good algorithms that i will happily share with who ever provides me with this code

     

    thanks

    #32144 quote
    GraHal
    Participant
    Master

    If you get the answer you need from this site would you share at least 1 of your good algos with this site … as that is what this site is all about.

    GraHal

    #32183 quote
    BestAlgoTrader
    Participant
    Junior

    Ok no problem ill share some if i get the answer

    #32229 quote
    AutoStrategist
    Participant
    Veteran

    Isn’t this the same question you asked 4 days ago under ‘Max number of open trades??’

    I believe the answer I gave works did you try it?

    #32233 quote
    BestAlgoTrader
    Participant
    Junior

    Yea i trie dbut it didnt work i got an error saying incomplete code

    #32237 quote
    BestAlgoTrader
    Participant
    Junior

    say for example this is my code:

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0

    // Conditions to enter long positions
    indicator1 = Stochastic[14,3](close)
    c1 = (indicator1 CROSSES OVER 70)
    indicator2 = Average[200](close)
    c2 = (close > indicator2)

    IF (c1 AND c2) AND not daysForbiddenEntry THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF

    // Stops and targets
    SET TARGET pPROFIT 10

     

     

    where should i enter the code you sent me to limit the trading to 3 per hour max???

     

    please copy my code and enter the relevant code and paste it back

     

    thanks in advance

    #32267 quote
    Elsborgtrading
    Participant
    Veteran

    Hello. As I can see from your first post you are using a daily timeframe or am I mistaken?

    Since our code is tested once at each timeframe we cannot calculate anything on a hourly basis if 1 day TF is used.

    if you want to only have 3 trades a hour you need to lower your timeframe to a max of 15 min.

    Cheers Kasper

    #32292 quote
    BestAlgoTrader
    Participant
    Junior

    That cose ewas example

    Please let me know how to do ot fpr a two minute chart

    I am using a 2 min timeframe

    Please use the code above and cchange it to two minute timeftame and enter the code to limit trading to three trades per hour max on a twp minute timeframe

    Thanks

    #32293 quote
    AutoStrategist
    Participant
    Veteran

    Hi AlreadyRich,

    Seems my original code was not so good (TRADEINDEX counts all transactions) not as straightforward a problem as it first sight appeared.

    Attached is some code which I believe does what you want which I have tested on DAX and DJI 2 minute charts.  let me know if this works for you.

    BestAlgoTrader thanked this post
    #32310 quote
    Elsborgtrading
    Participant
    Veteran

    Hi Rich.

    I don’t know it this will work- I cannot find a test where I have 3 trades within one hour, so can you test this?

    // Definition of code parameters
    DEFPARAM flatafter =220000
    DEFPARAM flatbefore=080000
    DEFPARAM CumulateOrders = false // Cumulating positions
    DEFPARAM PRELOADBARS = 100
    
    // Cumulating positions deactivated
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    // Conditions to enter long positions
    indicator1 = Stochastic[14,3](close)
    c1 = (indicator1 CROSSES OVER 70)
    indicator2 = Average[200](close)
    c2 = (close > indicator2)
    
    
    OnMarketBarCount=barindex-tradeindex
    once CountOfTrades =0
    once trade =0
    //once test1=1
    //if  OnMarketBarCount<=30 then
    IF OnMarketBarCount[1]<OnMarketBarCount THEN
    
    CountOfTrades=CountOfTrades
    elsif not onmarket then//OnMarketBarCount[1]>OnMarketBarCount THEN
    mytime=time
    CountOfTrades=CountOfTrades+1
    
    endif
    if mytime+010000<=time and countoftrades<=3 then
    trade=1
    elsif mytime+01000<=time and countoftrades>=3 then
    trade=0
    countoftrades=0
    endif
    //endif
    
    IF (c1 AND c2) AND not daysForbiddenEntry and CountOfTrades<=3 and trade THEN
    
    BUY 1 PERPOINT AT MARKET
    ENDIF
    
    //graph time COLOURED(0,0,0) AS "time"
    //graph CountOfTrades COLOURED(0,0,0) AS "CountOfTrades"
    //graph trade COLOURED(0,0,0) AS "trade"
    //graph mytime COLOURED(0,0,0) AS "mytime"
    BestAlgoTrader thanked this post
    #32311 quote
    Elsborgtrading
    Participant
    Veteran

    I see a error- line 32 is missing a 0

    elsif mytime+010000<=time and countoftrades>=3 then
    #32313 quote
    BestAlgoTrader
    Participant
    Junior

    thanks – i will test now

    #32368 quote
    BestAlgoTrader
    Participant
    Junior

    the backtest isnt working – i am getting results of no trades

    #32371 quote
    BestAlgoTrader
    Participant
    Junior

    Hi Autostrategist,

     

    your code seems like its on the right track however its still slightly off

     

    can you please create it in the same format as how the simplified creation normally creates its code.. i have pasted my code below…can you please merge the two into one code –  so that my below code is set to place no more than 3 trades per hour? thanks in advance

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    // Prevents the system from placing new orders on specified days of the week
    daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
    
    // Conditions to enter long positions
    indicator1 = Stochastic[14,3](close)
    c1 = (indicator1 CROSSES OVER 70)
    indicator2 = Average[200](close)
    c2 = (close > indicator2)
    
    IF (c1 AND c2) AND not daysForbiddenEntry THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF
    
    // Stops and targets
    SET TARGET pPROFIT 10
    #32506 quote
    AutoStrategist
    Participant
    Veteran

    Hi Rich,

    I took my code and added it in to yours.  You are a very brave man if you are running that strategy live, I wish you well with it. You know what they say if something looks too good to be true…

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

three trades per hour max


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 16 replies,
has 4 voices, and was last updated by AutoStrategist
8 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/15/2017
Status: Active
Attachments: 4 files
Logo Logo
Loading...