multiple strategies within one trading system

Forums ProRealTime English forum ProOrder support multiple strategies within one trading system

Viewing 15 posts - 1 through 15 (of 19 total)
  • #40921

    Hi,

    I’m trying to have a few strategies, triggered based on different conditions, within one trading system. Is it possible in PRT? And if yes, would anyone please give me a simple example and give advice on what mistakes to avoid and how to write it structurally correct?

    Thanks,

    Thomas

    #41185

    Sorry I wasn’t more specific before, I’m new to PRT. I just wondered whether you can run the code on various strategies within (condition1 and condition2) and have specific exit conditions linked with those strategies (ConditionToExit1 and ConditionToExit2) – but they will be triggered only to those assigned strategies (a = 1 or a = 2). It looks doable to me, but I wonder if there is any restriction.

    #41189

    Sounds good, so to keep the discussion simple, … You had Trade Entry on Condition A and Exit on Condition 1 (for example) but elsewhere in the same coded ‘Auto-Trading System’ you might use a different Condition for Exit … let’s call it Exit Condition 2 for example?

    Have I misunderstood your question?

    Generally the term Strategy / Strat / Bot / Algo is used to describe a coded ‘Auto-Trading System’ which runs on, for example, the DAX. You could of course run the same Strat on the EUR/USD, but likely your variables (the [20] in Average[20] ) may need to be optimised for the DAX different from the EUR/USD.

    Cheers
    GraHal

    1 user thanked author for this post.
    #41272

    I posted a template for multiple strategies in a single TS, click https://www.prorealcode.com/topic/allow-only-one-strategy-to-execute-a-trade/#post-34686

    Roberto

    2 users thanked author for this post.
    #41274

    Link doesn’t work Roberto (404 error – page not found) maybe it’s temporary and Nicolas is doing work on the site? Maybe leave and I’ll try it later?

    #41277
    #41278

    They seem not to work at the moment.

    Here is a copy of my post.

    You can assembly all of your strategies into a bigger file.

    “DEFPARAM CumulateOrders = false” will do the hard job!

    Of course you may need to name variables in different ways, say, a1s1 or cond1s1 for the first strategy, then a2s1/cond2s1….. a1s2/cond1s2 for the second strategy etc….

    You may name a variable StrategyID = 0 when NOT ONMARKET, then set it to any number you want each buy/sell is executed so you know which strategy was triggered.

    Example:

     

    4 users thanked author for this post.
    #41352

    Sorry for the broken links, for an unknown reason, some words are truncated..even if the link is correct in html format. I’m looking to fix this issue.

    #122369

    what if you have different timeframe strategies. and different stoploss and take profit strategies. and different opening and closing time strategies.. is there still a way to put them together in one tradingsystem?

    #122374

    In my example above I used TP & SL several times with the same values but they can be different.

    You can also use TIMEFRAME multiple times, as needed.

    You cannot use more than 5 different TF’s + default one.

    TIMEFRAME(1 hour,default) and TIMEFRAME(1 hour,updateonclose) count as one, not two!

    #160520

    Hi,

    Sorry for resurfacing an old thread, but I was having a similar conundrum. Is there a way of adding strategy specific exit rules, rather than just TP or SL? I tried doing so, but my sell rules seem to be mixing in the actual trading process. For example, this code exits trades that strategy 2 initiated based on strategy 1 exit parameters.

    Here’s my code:

    To illustrate my point, I’ve attached a screenshot of my strategy working. Strategy 2 -Separated is the code I used for strategy 2, but separated from the code I posted above. As you can see, Strategy 2 took the same trade as my initial code and held it until the exit criteria were met, whereas my original code immediately closes this trade because it meets strategy 1 exit rules.

     

    #160525

    The code you posted CANNOT close one strategy because of conditions from the other one.

    The two strategies are clearly separated with a  different ID and, as long as IF…ENDIF works, they cannot mix.

    The above code user RSI[14], while on your pic I can spot RSI[13], this can be a cause.

    I cannot test it because I don’t have the ATR indicator you are calling. Post it or post a link where I can find it.

     

    #160527

    Sure, the ATR that I am using is this indicator: https://www.prorealcode.com/prorealtime-indicators/another-atr-trailing-stop/

    The RSI that is on the chart is purely used for visualisation purposes and isn’t reflective of the strategy that I am using.

    Maybe my IF statements are wrongly worded? I ask because as soon as strategy 2 kicks in, the code I posted closes the position. See my screenshot:

    #160666

    Thenumber of parameters for the indicator is three:

    why did you use only two of them?

    What instrument is the one traded in your last pic?

     

    #160777

    Dear robertogozzi,

    Thank you for your reply. I’m attaching some extra info.

    First, the code to “Strategy 2 – separated”. As you can see its the same as strategy 2 in the first code I posted, so the ATR settings are exactly the same.

    Second, I have uploaded an expanded screenshot showing the instrument, along with the “graph StrategyID” function from the first code I posted.

    I believe that the issue rests with how I have worded my IF statements- could you please test?

Viewing 15 posts - 1 through 15 (of 19 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login