multiple strategies within one trading system

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #160780 quote
    AleksLiAleksLi
    Participant
    Junior

    I think I might’ve found the issue. With that particular trade that I am always referring to, in Feb of 2018, the graph function shows that Strategy 2 buying signal is given. However, since the signal is short-lived and StrategyID quickly reverts to “0”, this means that strategy 1 kicks in to close the position, as the code in strategy 1 is:

    IF (StrategyID = 0) OR (StrategyID = 1) THEN

    Could you help me fix this, please?

    Thank you,

    Aleks

    #160795 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    It’s short-lived because when evaluating conditions you haven’t added AND Not OnMarket, try this:

    IF c1 AND c2 AND c3 AND c4 AND c5 AND Not OnMarket THEN

    (for the other strategy as well).

    #160813 quote
    AleksLiAleksLi
    Participant
    Junior

    Hi, I’ve added your recommendations and nothing has changed.

    DEFPARAM CumulateOrders = false // Cumulating positions deactivated
    
    //dynamic position sizing
    INITIALCAPITAL = 10000
    c = (INITIALCAPITAL/close)
    if c < 0.2 then
    c = 0.2
    endif
    
    // Conditions to enter long positions
    
    IF NOT onmarket then
    StrategyID = 0
    ENDIF
    
    //trend following strategy
    IF (StrategyID = 0) OR (StrategyID = 1) THEN
    indicator1 = SAR[0.14,0.01,0.3]
    c1 = (close > indicator1)
    indicator2 = RSI[14](close)
    c2 = (indicator2 < 80)
    c3 = (close >= open)
    indicator3 = AroonUp[10]
    c4 = (indicator3 > 15)
    indicator4 = CALL "ATR"[14,2]
    c5 = (close > indicator4)
    IF c1 AND c2 AND c3 AND c4 AND c5 AND Not OnMarket THEN
    StrategyID = 1
    set stop $loss 420
    BUY c PERPOINT AT MARKET
    ENDIF
    indicator5 = SAR[0.14,0.01,0.3]
    c6 = (indicator5 > close)
    indicator6 = RSI[14](close)
    c7 = (indicator6 > 80)
    IF c6 OR c7 THEN
    SELL AT MARKET
    ENDIF
    ENDIF
    
    
    //mean reversion strategy
    IF (StrategyID = 0) OR (StrategyID = 2) THEN
    indicator4 = CALL "ATR"[14,2,1]
    c8 = (close < indicator4)
    indicator7 = RSI[14](close)
    c9 = (indicator7 < 30)
    IF c8 and c9 AND not onmarket THEN
    StrategyID = 2
    BUY c PERPOINT AT MARKET
    ENDIF
    c10= (indicator7 > 50)
    IF c10 THEN
    SELL AT MARKET
    ENDIF
    ENDIF
    
    
    graph StrategyID
    
    #160827 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I can’t find your issue on BITCOIN Daily, there’s nothing happening on Feb. 18th 2018. A long trade is opened on the 15th and closed on the 22nd. I think it’s a different instrument, I have XBTUSD Bitcoint (E1).

    I still can’t understand what your issue is.

    multiple strategies within one trading system

Viewing 4 posts - 16 through 19 (of 19 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

multiple strategies within one trading system


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Thomas007 @flawless007 Participant
Summary

This topic contains 18 replies,
has 6 voices, and was last updated by robertogozzirobertogozzi
5 years, 8 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 07/18/2017
Status: Active
Attachments: 3 files
ProRealCode ProRealCode
Loading...