2 Trading Strategies in one system

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #232873 quote
    Lambo
    Participant
    New

    Hello

    I would like to backtest a system with has two different entrys. Every Entry has his own exit Strategies for take profit and SL.

    Is it possible to connect

    Entry 1 with Exit  parameter 1

    Entry 2 with Exit parameter 2

    Thank you!

    #232882 quote
    robertogozzi
    Moderator
    Master

    There you go:

    DEFPARAM CumulateOrders = false
    //
    IF Not OnMarket THEN
       ID = 0
    ENDIF
    //
    // strategy 1
    //
    MyLongCondition1  = close CROSSES OVER  average[20,0](close)
    MyShortCondition1 = close CROSSES UNDER average[20,0](close)
    IF Not OnMarket AND MyLongCondition1 THEN
       BUY 1 CONTRACT AT MARKET
       SET STOP   pLOSS   100
       SET TARGET pPROFIT 200
       ID = 1
    ENDIF
    IF Not OnMarket AND MyShortCondition1 THEN
       SELLSHORT 1 CONTRACT AT MARKET
       SET STOP   pLOSS   100
       SET TARGET pPROFIT 200
       ID = 1
    ENDIF
    //
    // strategy 2
    //
    MyLongCondition2  = Rsi[14](close) CROSSES OVER  50
    MyShortCondition2 = Rsi[14](close) CROSSES UNDER 50
    IF Not OnMarket AND MyLongCondition2 THEN
       BUY 1 CONTRACT AT MARKET
       SET STOP   pLOSS   120
       SET TARGET pPROFIT 240
       ID = 2
    ENDIF
    IF Not OnMarket AND MyShortCondition2 THEN
       SELLSHORT 1 CONTRACT AT MARKET
       SET STOP   pLOSS   120
       SET TARGET pPROFIT 240
       ID = 2
    ENDIF
    graph ID
    Lambo thanked this post
    #232889 quote
    Lambo
    Participant
    New

    Thank you

    How I have to change the code if i want to trade strategy 1 and 2 simultaneously.

    How can i splitt my strategy capital?

    I have 100.000 for each strategy.

    Thank you sir!

    #232912 quote
    robertogozzi
    Moderator
    Master

    For the system it’s ONE strategy, so you can’t split the Capital among the two separate logical entries.

    If you want to allow both entries go the same direction, then you need to allow accumulating orders, then do not check that you are onmarket when openuing a new piosition.

    If, instead, you only want to allow them to go the opposite directions, then you have to bear in mind that the same strategy CANNOT open two opposite trades. So in this case you will need to resort to Stop & Reverse, thus closing the LONG trade when you want to go SHORT and viceversa.

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

2 Trading Strategies in one system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Lambo @lambo Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
1 year, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/21/2024
Status: Active
Attachments: No files
Logo Logo
Loading...