Multiple Running Algo and margin requirement

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #175499 quote
    gfx
    Participant
    Average

    Hello all,

    I just added a second trading system to my IG PRT account.

    I wanted to keep both systems independant to avoid over coding or facing issues that I would not have keeping them appart.

    But, I noticed that once the first one was in position, any triggered order from the second one would be rejected by IG ( which I understand due to margin requirement).

    Thing is that once the order is rejected, the trading system which triggered the order it is stopped by IG.

    Have you already faced this issue ? Is there any work around ?

    thks.

    Gfx

    #175500 quote
    robertogozzi
    Moderator
    Master

    If it’s margin related, then it’s an issue  you only can work out by funding your account.

    #175506 quote
    GraHal
    Participant
    Master

    If it’s on your Demo Account then you can easily increase Capital by adding more virtual money up to £10m.

    #175507 quote
    Nicolas
    Keymaster
    Master

    Or reduce your contract size / exposure on each of your strategy, if possible.

    #175514 quote
    gfx
    Participant
    Average

    ok thks. So I understand that there is no work around to having both systems in a single one and to manage dual triggers.

    Having two accounts, one for each, or allocating 50% of account size to each will definitively reduce the profits.

    Indeed, most of the time, they are not supposed to open trade at the same time.

    Thks for helping.

    #175536 quote
    Nicolas
    Keymaster
    Master

    You can of course, compile the 2 strategies into a single one. You’ll have to set the required conditions to only trade one strategy at a time.

    #175539 quote
    robertogozzi
    Moderator
    Master
    #175540 quote
    robertogozzi
    Moderator
    Master

    Sorry, the link seems not to work.

    #175541 quote
    robertogozzi
    Moderator
    Master
    #175544 quote
    robertogozzi
    Moderator
    Master

    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:

    DEFPARAM CumulateOrders = False                                 //Only 1 trade at a time
     
    IF NOT OnMarket THEN                                            //Make sure you reset this variable to ZERO when not trading
       StrategyID = 0
    ENDIF
    //-----------------------------------------------------------------------------------------------------------------
    IF (StrategyID = 0) OR (StrategyID = 1) THEN					//Strategy 1
       s1.... = ......
       .
       .
    ENDIF
    //-----------------------------------------------------------------------------------------------------------------
    IF (StrategyID = 0) OR (StrategyID = 2) THEN					//Strategy 2
       s2Avg = Average[20](close)
       s2Rsi = Rsi[14]
       .
       .
       .
       //************************************************************************
       //                                 LONG
       //************************************************************************
       IF close CROSSES OVER s2Avg  THEN
          StrategyID = 2
          SET TARGET PPROFIT 20
          SET STOP PLOSS     10
          BUY nLots CONTRACT AT MARKET
       ENDIF
       //************************************************************************
       //                                 SHORT
       //************************************************************************
       IF close CROSSES UNDER s2Avg  THEN
          StrategyID = 2
          SET TARGET PPROFIT 20
          SET STOP PLOSS     10
          SELLSHORT nLots CONTRACT AT MARKET
       ENDIF
       .
       .
       .
       .
    ENDIF
    //-----------------------------------------------------------------------------------------------------------------
    IF (StrategyID = 0) OR (StrategyID = 3) THEN					//Strategy 3
       s3.... = ......
       .
       .
       .
    ENDIF
    #175546 quote
    gfx
    Participant
    Average

    Thks for the framework.  DEFPARAM CumulateOrders = True shall still be ok if I use the StrategyId variable. Correct ? Indeed, one strategy requires scaling in with is not possible if I set DEFP to False.

    Won’t StrategyId be reset at each candle ? I remember that there was an issue with PRT as far as keeping value persistent in variables.

    #175551 quote
    robertogozzi
    Moderator
    Master

    Yes with DEFPARAM = True, you can decide to accumulate positions or not with (NOT) ON MARKET.

    As to variables, use different names for each strategy, but for StrategyID.

    You can even set different trading and closing hours for each strategy.

    Whatever you want to make common to ALL strategies needs to be written outside them.

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

Multiple Running Algo and margin requirement


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
gfx @gfx Participant
Summary

This topic contains 11 replies,
has 4 voices, and was last updated by robertogozzi
4 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/16/2021
Status: Active
Attachments: No files
Logo Logo
Loading...