Multiple Running Algo and margin requirement
Forums › ProRealTime English forum › ProOrder support › Multiple Running Algo and margin requirement
- This topic has 11 replies, 4 voices, and was last updated 3 years ago by robertogozzi.
-
-
08/16/2021 at 10:50 PM #175499
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
08/17/2021 at 1:36 AM #175500If it’s margin related, then it’s an issue you only can work out by funding your account.
08/17/2021 at 7:51 AM #17550608/17/2021 at 8:04 AM #17550708/17/2021 at 8:40 AM #175514ok 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.
08/17/2021 at 12:31 PM #17553608/17/2021 at 1:07 PM #175539An example can be found here https://www.prorealcode.com/topic/multiple-strategies-within-one-trading-system/#post-41278
08/17/2021 at 1:08 PM #175540Sorry, the link seems not to work.
08/17/2021 at 1:10 PM #175541Try this one, then go to post 41278 https://www.prorealcode.com/topic/multiple-strategies-within-one-trading-system/
08/17/2021 at 1:21 PM #175544Here 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:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748DEFPARAM CumulateOrders = False //Only 1 trade at a timeIF NOT OnMarket THEN //Make sure you reset this variable to ZERO when not tradingStrategyID = 0ENDIF//-----------------------------------------------------------------------------------------------------------------IF (StrategyID = 0) OR (StrategyID = 1) THEN //Strategy 1s1.... = ........ENDIF//-----------------------------------------------------------------------------------------------------------------IF (StrategyID = 0) OR (StrategyID = 2) THEN //Strategy 2s2Avg = Average[20](close)s2Rsi = Rsi[14]...//************************************************************************// LONG//************************************************************************IF close CROSSES OVER s2Avg THENStrategyID = 2SET TARGET PPROFIT 20SET STOP PLOSS 10BUY nLots CONTRACT AT MARKETENDIF//************************************************************************// SHORT//************************************************************************IF close CROSSES UNDER s2Avg THENStrategyID = 2SET TARGET PPROFIT 20SET STOP PLOSS 10SELLSHORT nLots CONTRACT AT MARKETENDIF....ENDIF//-----------------------------------------------------------------------------------------------------------------IF (StrategyID = 0) OR (StrategyID = 3) THEN //Strategy 3s3.... = .........ENDIF08/17/2021 at 1:26 PM #175546Thks 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.
08/17/2021 at 2:27 PM #175551Yes 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.
-
AuthorPosts
Find exclusive trading pro-tools on