Multiple strategies in one strategy.

Viewing 13 posts - 16 through 28 (of 28 total)
  • Author
    Posts
  • #150182 quote
    Vonasi
    Moderator
    Master

    I don’t think my coding idea can work with STOP orders and Renko bricks. With Renko brick sizes you would simply always be placing a STOP order at the closest level for the smallest brick.

    eckaw thanked this post
    #237820 quote
    dubbzie
    Participant
    New

    Hi all,

    I have read this thread with great interest, but unfortunately, I can’t find exactly what I’m looking for. I have three strategies, A, B, and C, which are quite similar. I want up to two of the strategies to be able to take a position  but not all three at the same time (as it would result in too big exposure). Does anyone know how this can be solved?

    #237821 quote
    ProfitAlgos
    Participant
    Junior

    Hi. Try this

    Mods edit: link edited out

     

    DEFPARAM CUMULATEORDERS = true
    
    once trade=0
    
    IF YourTradeIdeaA and trade<=2 THEN
    BUY PositionSize CONTRACT AT MARKET
    trade=1
    ENDIF
    
    IF YourTradeIdeaB and trade<=2 THEN
    BUY PositionSize CONTRACT AT MARKET
    trade=1
    ENDIF
    
    IF YourTradeIdeaC and trade<=2 THEN
    BUY PositionSize CONTRACT AT MARKET
    trade=1
    ENDIF

    #237834 quote
    PeterSt
    Participant
    Master

    🙁

    JC_Bywan thanked this post
    #237835 quote
    JS
    Participant
    Senior

    Hi,

    To count the number of transactions use:

    Trade=Trade+1

    ProfitAlgos and JC_Bywan thanked this post
    #237839 quote
    dubbzie
    Participant
    New
    Thank you so much, ProfitAlgos. This solved the entire challenge!👍🎯
    ProfitAlgos thanked this post
    #237841 quote
    JC_Bywan
    Moderator
    Master
    Moderation point: please don’t add link to a marketplace product in a proorder topic when it’s irrelevant to the topic, keep such links to relevant store dedicated topic in the “general trading discussions”, thanks. Link has been edited out.
    ProfitAlgos thanked this post
    #237842 quote
    ProfitAlgos
    Participant
    Junior
    Glad, it worked out for you 😊
    #237846 quote
    dubbzie
    Participant
    New
    Hmmm… that was probably a bit of a hasty judgment on my part. I also tried to include Trade=Trade+1 to count the number of transactions, as JS suggests, but then it doesn’t take a position. Should Trade=Trade+1 replace Trade=1, or how should the script look?
    #237848 quote
    JS
    Participant
    Senior

    Swap “Trade=1” for “Trade=Trade+1″…

    #237872 quote
    ProfitAlgos
    Participant
    Junior
    Like this  
    DEFPARAM CUMULATEORDERS = true
     
    once trade=0
     
    IF YourTradeIdeaA and trade<=2 THEN
    BUY PositionSize CONTRACT AT MARKET
    trade=trade+1
    ENDIF
     
    IF YourTradeIdeaB and trade<=2 THEN
    BUY PositionSize CONTRACT AT MARKET
    trade=trade+1
    ENDIF
     
    IF YourTradeIdeaC and trade<=2 THEN
    BUY PositionSize CONTRACT AT MARKET
    trade=trade+1
    ENDIF
    #239386 quote
    dubbzie
    Participant
    New
    Thanks to those who have provided comments and scripts on how to combine multiple strategies into one. It works well and is very useful! An even better solution might be if each strategy could be started separately (as standalone strategies instead of all being combined into one), otherwise, you would have to stop all of them if you want to make a change to one of the strategies. Does anyone know if it’s possible to add to each strategy’s script that it should go long if the number of long contracts on my account is a maximum of x, and otherwise not?
    #239390 quote
    GraHal
    Participant
    Master
    No, we can’t do that, each strategy has to operate in isolation and cannot receive information from outside the strategy code etc.
    dubbzie thanked this post
Viewing 13 posts - 16 through 28 (of 28 total)
  • You must be logged in to reply to this topic.

Multiple strategies in one strategy.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 27 replies,
has 8 voices, and was last updated by GraHal
1 year, 3 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/22/2018
Status: Active
Attachments: 1 files
Logo Logo
Loading...