max number of open trades??

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30207 quote
    BestAlgoTrader
    Participant
    Junior

    DOES ANYOEN HAVE THE CODE FOR

     

    max number of open trades??

    EG YOU WANT YOUR ALGO TO ONLY have a max number of open trades to be 5 ( so it wont open any more trade in 5 are already open)

    or

    have a max number of open trades to be 1 ( so it wont open any more trade if 1 is are already open)

    #30373 quote
    Nicolas
    Keymaster
    Master

    Everything’s related to ProBacktest/ProOrder coding can be found in the online documentation: https://www.prorealcode.com/documentation/category/probacktest/

    You are looking for COUNTOFLONGSHARES and COUNTOFSHORTSHARES

    #30455 quote
    BestAlgoTrader
    Participant
    Junior

    thanks

    #30553 quote
    BestAlgoTrader
    Participant
    Junior

    do you know how to limit the max number of trades placed in one hour ? eg have the algo place no more than 3 trades in any one hour period?

    #30572 quote
    AutoStrategist
    Participant
    Veteran
    Didn’t say what timeframe you are using, have used 5 minute chart to get 12 bars  e.g.  3 minute bars would be 20 bars.  Only takes a position if third last trade was over an hour ago.
    NumberOfBarsInHour = 12
    TradeBar = TRADEINDEX(3)
    if TradeBar = 0 or (barindex – TradeBar > NumberOfBarsInHour) then
    //if some condition then
    //buy or sell
    //endif
    endif
    Nicolas and BestAlgoTrader thanked this post
    #31865 quote
    BestAlgoTrader
    Participant
    Junior

    thanks auto strategist!

     

    I am using a 2 min chart – this is my code

     

    NumberOfBarsInHour = 30
    TradeBar = TRADEINDEX(3)

    if TradeBar = 0 or (barindex – TradeBar > NumberOfBarsInHour) then

     

     

    do i need to add anything else to it or will the above code limit my system to trade 3 times per hour max ?

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

max number of open trades??


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by BestAlgoTrader
8 years, 11 months ago.

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